From 2539899934acd2ecedb190da08dfd733ca497b81 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Mon, 21 Jan 2019 10:50:22 +1300 Subject: [PATCH] Fix notification specs --- spec/models/notification_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/models/notification_spec.rb b/spec/models/notification_spec.rb index 33f053bfd..330a97003 100644 --- a/spec/models/notification_spec.rb +++ b/spec/models/notification_spec.rb @@ -33,17 +33,17 @@ describe Notification do it "sends email if asked" do @notification2 = FactoryBot.create(:notification) @notification2.send_email - expect(ActionMailer::Base.deliveries.last.to).to eq [@notification2.recipient.email] + expect(ActionMailer::Base.deliveries.last&.to).to eq [@notification2.recipient.email] end it "doesn't send email to people who don't want it" do FactoryBot.create(:no_email_notification).send_email - expect(ActionMailer::Base.deliveries.last.to).not_to eq [notification.recipient.email] + expect(ActionMailer::Base.deliveries.last&.to).not_to eq [notification.recipient.email] end it "sends email on creation" do @notification2 = FactoryBot.create(:notification) - expect(ActionMailer::Base.deliveries.last.to).to eq [@notification2.recipient.email] + expect(ActionMailer::Base.deliveries.last&.to).to eq [@notification2.recipient.email] end it "replaces missing subjects with (no subject)" do