From 07cc94e05fa89794714fb0434529657dfa992bca Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Thu, 6 Jun 2024 10:19:22 -0400 Subject: [PATCH] Use `sidekiq_inline` in requests/api/v1/admin/account_actions spec (#30563) --- spec/requests/api/v1/admin/account_actions_spec.rb | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/spec/requests/api/v1/admin/account_actions_spec.rb b/spec/requests/api/v1/admin/account_actions_spec.rb index 4167911a13..778658508e 100644 --- a/spec/requests/api/v1/admin/account_actions_spec.rb +++ b/spec/requests/api/v1/admin/account_actions_spec.rb @@ -10,10 +10,16 @@ RSpec.describe 'Account actions' do let(:headers) { { 'Authorization' => "Bearer #{token.token}" } } shared_examples 'a successful notification delivery' do - it 'notifies the user about the action taken' do - expect { subject } - .to have_enqueued_job(ActionMailer::MailDeliveryJob) - .with('UserMailer', 'warning', 'deliver_now!', args: [User, AccountWarning]) + it 'notifies the user about the action taken', :sidekiq_inline do + emails = capture_emails { subject } + + expect(emails.size) + .to eq(1) + + expect(emails.first) + .to have_attributes( + to: contain_exactly(target_account.user.email) + ) end end