0
0
Fork 0

Use capture_emails helper to improve email assertions in specs (#29245)

This commit is contained in:
Matt Jankowski 2024-02-19 10:57:47 -05:00 committed by GitHub
parent 86627ea2e4
commit 64f9939e39
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 97 additions and 47 deletions

View file

@ -158,13 +158,14 @@ RSpec.describe ReportService, type: :service do
before do
Fabricate(:report, target_account: target_account)
ActionMailer::Base.deliveries.clear
source_account.user.settings['notification_emails.report'] = true
source_account.user.save
end
it 'does not send an e-mail' do
expect { subject.call }.to_not change(ActionMailer::Base.deliveries, :count).from(0)
emails = capture_emails { subject.call }
expect(emails).to be_empty
end
end
end