Commit ab826443b9459aa35a0eef9fd2b99f2fa4bb6078
Exists in
master
and in
1 other branch
Merge pull request #112 from versapay/master
Reset notice count when an issue is resolved
Showing
2 changed files
with
19 additions
and
1 deletions
Show diff stats
app/models/problem.rb
spec/models/notice_spec.rb
... | ... | @@ -106,6 +106,24 @@ describe Notice do |
106 | 106 | end |
107 | 107 | end |
108 | 108 | |
109 | + describe "email notifications for a resolved issue" do | |
109 | 110 | |
111 | + before do | |
112 | + Errbit::Config.per_app_email_at_notices = true | |
113 | + @app = Factory(:app_with_watcher, :email_at_notices => [1]) | |
114 | + @err = Factory(:err, :problem => Factory(:problem, :app => @app, :notices_count => 100)) | |
115 | + end | |
116 | + | |
117 | + after do | |
118 | + Errbit::Config.per_app_email_at_notices = false | |
119 | + end | |
120 | + | |
121 | + it "should send email notification after 1 notice since an error has been resolved" do | |
122 | + @err.problem.resolve! | |
123 | + Mailer.should_receive(:err_notification). | |
124 | + and_return(mock('email', :deliver => true)) | |
125 | + Factory(:notice, :err => @err) | |
126 | + end | |
127 | + end | |
110 | 128 | end |
111 | 129 | ... | ... |