spec/lib/flapjack/data/notification_spec.rb in flapjack-0.7.27 vs spec/lib/flapjack/data/notification_spec.rb in flapjack-0.7.28

- old
+ new

@@ -1,15 +1,15 @@ require 'spec_helper' require 'flapjack/data/notification' describe Flapjack::Data::Notification, :redis => true, :logger => true do - let(:event) { mock(Flapjack::Data::Event) } + let(:event) { double(Flapjack::Data::Event) } - let(:contact) { mock(Flapjack::Data::Contact) } + let(:contact) { double(Flapjack::Data::Contact) } - let(:timezone) { mock('timezone') } + let(:timezone) { double('timezone') } it "generates a notification for an event" # do # notification = Flapjack::Data::Notification.for_event(event, :type => 'problem', # :max_notified_severity => nil, :contacts => [contact], # :default_timezone => timezone, :logger => @logger) @@ -25,9 +25,17 @@ contact.should_receive(:id).and_return('23') contact.should_receive(:notification_rules).and_return([]) contact.should_receive(:media).and_return('email' => 'example@example.com', 'sms' => '0123456789') + contact.should_receive(:add_alerting_check_for_media).with("email", nil) + contact.should_receive(:add_alerting_check_for_media).with("sms", nil) + contact.should_receive(:clean_alerting_checks_for_media).with("email").and_return(0) + contact.should_receive(:clean_alerting_checks_for_media).with("sms").and_return(0) + contact.should_receive(:count_alerting_checks_for_media).with("email").and_return(0) + contact.should_receive(:count_alerting_checks_for_media).with("sms").and_return(0) + contact.should_receive(:rollup_threshold_for_media).with("email").and_return(nil) + contact.should_receive(:rollup_threshold_for_media).with("sms").and_return(nil) messages = notification.messages([contact], :default_timezone => timezone, :logger => @logger) messages.should_not be_nil messages.should have(2).items