Add email_spec
and speedup/cleanup to spec/mailers
(#27902)
This commit is contained in:
parent
9c68741f46
commit
549e8e7baf
7 changed files with 194 additions and 152 deletions
|
@ -8,18 +8,12 @@ RSpec.describe 'Account actions' do
|
|||
let(:scopes) { 'admin:write admin:write:accounts' }
|
||||
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
|
||||
let(:headers) { { 'Authorization' => "Bearer #{token.token}" } }
|
||||
let(:mailer) { instance_double(ActionMailer::MessageDelivery, deliver_later!: nil) }
|
||||
|
||||
before do
|
||||
allow(UserMailer).to receive(:warning).with(target_account.user, anything).and_return(mailer)
|
||||
end
|
||||
|
||||
shared_examples 'a successful notification delivery' do
|
||||
it 'notifies the user about the action taken' do
|
||||
subject
|
||||
|
||||
expect(UserMailer).to have_received(:warning).with(target_account.user, anything).once
|
||||
expect(mailer).to have_received(:deliver_later!).once
|
||||
expect { subject }
|
||||
.to have_enqueued_job(ActionMailer::MailDeliveryJob)
|
||||
.with('UserMailer', 'warning', 'deliver_now!', args: [User, AccountWarning])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue