From a662c6d1d82fbc0bb27a2d0a55c1a1c028c16dea Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Thu, 6 Jun 2024 10:12:58 -0400 Subject: [PATCH] Use `sidekiq_inline` in admin/account_action model spec (#30565) --- spec/models/admin/account_action_spec.rb | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/spec/models/admin/account_action_spec.rb b/spec/models/admin/account_action_spec.rb index a9dcf352dc..e55db2f814 100644 --- a/spec/models/admin/account_action_spec.rb +++ b/spec/models/admin/account_action_spec.rb @@ -69,20 +69,22 @@ RSpec.describe Admin::AccountAction do end end - it 'sends notification, log the action, and closes other reports', :aggregate_failures do - other_report = Fabricate(:report, target_account: target_account) - - emails = [] - expect do - emails = capture_emails { subject } - end.to (change(Admin::ActionLog.where(action: type), :count).by 1) - .and(change { other_report.reload.action_taken? }.from(false).to(true)) + it 'sends email to target account user', :sidekiq_inline do + emails = capture_emails { subject } expect(emails).to contain_exactly( have_attributes( to: contain_exactly(target_account.user.email) ) ) + end + + it 'sends notification, log the action, and closes other reports', :aggregate_failures do + other_report = Fabricate(:report, target_account: target_account) + + expect { subject } + .to (change(Admin::ActionLog.where(action: type), :count).by 1) + .and(change { other_report.reload.action_taken? }.from(false).to(true)) expect(LocalNotificationWorker).to have_enqueued_sidekiq_job(target_account.id, anything, 'AccountWarning', 'moderation_warning') end