Commit 60a14b60088350f5eda9ba96f814a37ac7fada5b
1 parent
1c1a0322
Exists in
master
and in
1 other branch
Actually enabling global email frequency setup.
Showing
2 changed files
with
6 additions
and
1 deletions
Show diff stats
app/models/notice.rb
| ... | ... | @@ -87,7 +87,7 @@ class Notice |
| 87 | 87 | protected |
| 88 | 88 | |
| 89 | 89 | def should_notify? |
| 90 | - err.app.notify_on_errs? && err.app.email_at_notices.include?(err.notices.count) && err.app.watchers.any? | |
| 90 | + err.app.notify_on_errs? && (Errbit::Config.per_app_email_at_notices && err.app.email_at_notices || Errbit::Config.email_at_notices).include?(err.notices.count) && err.app.watchers.any? | |
| 91 | 91 | end |
| 92 | 92 | |
| 93 | 93 | ... | ... |
spec/models/notice_spec.rb
| ... | ... | @@ -170,10 +170,15 @@ describe Notice do |
| 170 | 170 | custom_thresholds = [2, 4, 8, 16, 32, 64] |
| 171 | 171 | |
| 172 | 172 | before do |
| 173 | + Errbit::Config.per_app_email_at_notices = true | |
| 173 | 174 | @app = Factory(:app_with_watcher, :email_at_notices => custom_thresholds) |
| 174 | 175 | @err = Factory(:err, :app => @app) |
| 175 | 176 | end |
| 176 | 177 | |
| 178 | + after do | |
| 179 | + Errbit::Config.per_app_email_at_notices = false | |
| 180 | + end | |
| 181 | + | |
| 177 | 182 | custom_thresholds.each do |threshold| |
| 178 | 183 | it "sends an email notification after #{threshold} notice(s)" do |
| 179 | 184 | @err.notices.stub(:count).and_return(threshold) | ... | ... |