spec/lib/flapjack/data/notification_spec.rb in flapjack-0.7.35 vs spec/lib/flapjack/data/notification_spec.rb in flapjack-0.8.0

- old
+ new

@@ -21,33 +21,33 @@ it "generates messages for contacts" do # TODO sensible default values for notification, check that they're passed # in message.notification_contents notification = Flapjack::Data::Notification.new - contact.should_receive(:id).and_return('23') - contact.should_receive(:notification_rules).and_return([]) - contact.should_receive(:media).and_return('email' => 'example@example.com', + expect(contact).to receive(:id).and_return('23') + expect(contact).to receive(:notification_rules).and_return([]) + expect(contact).to 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) + expect(contact).to receive(:add_alerting_check_for_media).with("email", nil) + expect(contact).to receive(:add_alerting_check_for_media).with("sms", nil) + expect(contact).to receive(:clean_alerting_checks_for_media).with("email").and_return(0) + expect(contact).to receive(:clean_alerting_checks_for_media).with("sms").and_return(0) + expect(contact).to receive(:count_alerting_checks_for_media).with("email").and_return(0) + expect(contact).to receive(:count_alerting_checks_for_media).with("sms").and_return(0) + expect(contact).to receive(:rollup_threshold_for_media).with("email").and_return(nil) + expect(contact).to 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 + expect(messages).not_to be_nil + expect(messages.size).to eq(2) - messages.first.contact.should == contact - messages.first.medium.should == 'email' - messages.first.address.should == 'example@example.com' + expect(messages.first.contact).to eq(contact) + expect(messages.first.medium).to eq('email') + expect(messages.first.address).to eq('example@example.com') - messages.last.contact.should == contact - messages.last.medium.should == 'sms' - messages.last.address.should == '0123456789' + expect(messages.last.contact).to eq(contact) + expect(messages.last.medium).to eq('sms') + expect(messages.last.address).to eq('0123456789') end end