Skip to content

Commit ce0e2c8

Browse files
committed
adds expects for a notification getting sent and to the correct email
1 parent 8318869 commit ce0e2c8

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

spec/mailers/better_together/conversation_mailer_spec.rb

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
require 'rails_helper'
44

55
module BetterTogether
6-
RSpec.describe ConversationMailer, type: :mailer do
7-
describe 'new_message_notification' do
6+
RSpec.describe ConversationMailer, type: :mailer do # rubocop:todo Metrics/BlockLength
7+
describe 'new_message_notification' do # rubocop:todo Metrics/BlockLength
88
let!(:host_platform) { create(:platform, :host) }
99
let(:sender) { create(:user) }
1010
let(:recipient) { create(:user) }
@@ -27,6 +27,16 @@ module BetterTogether
2727
expect(mail.body.encoded).to have_content("#{sender.person.name}:")
2828
expect(mail.body.encoded).to have_content(message.content.to_plain_text)
2929
end
30+
31+
it 'sends a message notification email' do
32+
expect { mail.deliver_now }
33+
.to change { ActionMailer::Base.deliveries.count }.by(1)
34+
end
35+
36+
it 'sends the message notification to the correct email address' do
37+
mail.deliver_now
38+
expect(ActionMailer::Base.deliveries.last.to).to include(recipient.email)
39+
end
3040
end
3141
end
3242
end

0 commit comments

Comments
 (0)