Commit 06fd651a4f22f9ae7ce0f78be861e67c2c21f066
1 parent
a1eb6072
Exists in
master
and in
1 other branch
Reset notice count when an issue is resolved and send emails when appropriate
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,6 +106,24 @@ describe Notice do | ||
106 | end | 106 | end |
107 | end | 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 | end | 128 | end |
111 | 129 |