Commit fa6dd7ff76d2ccf9e3efeaff80bc023332981bdf
1 parent
0b1a1c4c
Exists in
master
and in
1 other branch
Duplicate spec for sending a notification and invert to test for issue 260
Showing
1 changed file
with
22 additions
and
0 deletions
Show diff stats
spec/models/notice_observer_spec.rb
... | ... | @@ -65,5 +65,27 @@ describe NoticeObserver do |
65 | 65 | :backtrace => [{ :error => 'Le Broken' }], :notifier => { 'name' => 'Notifier', 'version' => '1', 'url' => 'http://toad.com' }) |
66 | 66 | end |
67 | 67 | end |
68 | + describe "should not send a notification if a notification service is not configured" do | |
69 | + let(:app) { app = Fabricate(:app, :email_at_notices => [1], :notification_service => Fabricate(:notification_service))} | |
70 | + let(:err) { Fabricate(:err, :problem => Fabricate(:problem, :app => app, :notices_count => 100)) } | |
71 | + | |
72 | + before do | |
73 | + Errbit::Config.per_app_email_at_notices = true | |
74 | + end | |
75 | + | |
76 | + after do | |
77 | + Errbit::Config.per_app_email_at_notices = false | |
78 | + end | |
79 | + | |
80 | + it "should not create a campfire notification" do | |
81 | + err.problem.stub(:notices_count) { 1 } | |
82 | + #app.notification_service.stub!(:create_notification).and_return(true) | |
83 | + app.stub!(:notification_recipients => %w('ryan@system88.com')) | |
84 | + app.notification_service.should_not_receive(:create_notification) | |
85 | + | |
86 | + Notice.create!(:err => err, :message => 'FooError: Too Much Bar', :server_environment => {'environment-name' => 'production'}, | |
87 | + :backtrace => [{ :error => 'Le Broken' }], :notifier => { 'name' => 'Notifier', 'version' => '1', 'url' => 'http://toad.com' }) | |
88 | + end | |
89 | + end | |
68 | 90 | |
69 | 91 | end | ... | ... |