From 60a14b60088350f5eda9ba96f814a37ac7fada5b Mon Sep 17 00:00:00 2001 From: Nick Recobra Date: Sun, 7 Aug 2011 13:44:47 +0400 Subject: [PATCH] Actually enabling global email frequency setup. --- app/models/notice.rb | 2 +- spec/models/notice_spec.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/models/notice.rb b/app/models/notice.rb index d7d07b0..0d4b837 100644 --- a/app/models/notice.rb +++ b/app/models/notice.rb @@ -87,7 +87,7 @@ class Notice protected def should_notify? - err.app.notify_on_errs? && err.app.email_at_notices.include?(err.notices.count) && err.app.watchers.any? + 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? end diff --git a/spec/models/notice_spec.rb b/spec/models/notice_spec.rb index 2d29c86..a786dd2 100644 --- a/spec/models/notice_spec.rb +++ b/spec/models/notice_spec.rb @@ -170,10 +170,15 @@ describe Notice do custom_thresholds = [2, 4, 8, 16, 32, 64] before do + Errbit::Config.per_app_email_at_notices = true @app = Factory(:app_with_watcher, :email_at_notices => custom_thresholds) @err = Factory(:err, :app => @app) end + after do + Errbit::Config.per_app_email_at_notices = false + end + custom_thresholds.each do |threshold| it "sends an email notification after #{threshold} notice(s)" do @err.notices.stub(:count).and_return(threshold) -- libgit2 0.21.2