Commit 31e6766991bd05ff040b128830cb897e0869cf29
1 parent
52b9cafb
Exists in
master
and in
1 other branch
Only resolve errs on deploy which are in the same environment
Showing
3 changed files
with
8 additions
and
5 deletions
Show diff stats
app/models/deploy.rb
app/models/err.rb
@@ -18,6 +18,7 @@ class Err | @@ -18,6 +18,7 @@ class Err | ||
18 | scope :resolved, where(:resolved => true) | 18 | scope :resolved, where(:resolved => true) |
19 | scope :unresolved, where(:resolved => false) | 19 | scope :unresolved, where(:resolved => false) |
20 | scope :ordered, order_by(:last_notice_at.desc) | 20 | scope :ordered, order_by(:last_notice_at.desc) |
21 | + scope :in_env, lambda {|env| where(:environment => env)} | ||
21 | 22 | ||
22 | def self.for(attrs) | 23 | def self.for(attrs) |
23 | app = attrs.delete(:app) | 24 | app = attrs.delete(:app) |
spec/models/deploy_spec.rb
@@ -33,11 +33,13 @@ describe Deploy do | @@ -33,11 +33,13 @@ describe Deploy do | ||
33 | end | 33 | end |
34 | 34 | ||
35 | context 'when the app has resolve_errs_on_deploy set to true' do | 35 | context 'when the app has resolve_errs_on_deploy set to true' do |
36 | - it 'should not resolve the apps errs' do | 36 | + it 'should resolve the apps errs that were in the same environment' do |
37 | app = Factory(:app, :resolve_errs_on_deploy => true) | 37 | app = Factory(:app, :resolve_errs_on_deploy => true) |
38 | - @errs = 3.times.inject([]) {|errs,_| errs << Factory(:err, :resolved => false, :app => app)} | ||
39 | - Factory(:deploy, :app => app) | ||
40 | - app.reload.errs.all?{|err| err.resolved?}.should == true | 38 | + @prod_errs = 3.times.inject([]) {|errs,_| errs << Factory(:err, :resolved => false, :app => app, :environment => 'production')} |
39 | + @staging_errs = 3.times.inject([]) {|errs,_| errs << Factory(:err, :resolved => false, :app => app, :environment => 'staging')} | ||
40 | + Factory(:deploy, :app => app, :environment => 'production') | ||
41 | + @prod_errs.all?{|err| err.reload.resolved?}.should == true | ||
42 | + @staging_errs.all?{|err| err.reload.resolved?}.should == false | ||
41 | end | 43 | end |
42 | end | 44 | end |
43 | end | 45 | end |