Merge remote-tracking branch 'parent/main' into upstream-20240426

This commit is contained in:
KMY 2024-04-26 09:16:08 +09:00
commit c4017eb993
22 changed files with 389 additions and 146 deletions

View file

@ -69,22 +69,22 @@ RSpec.describe Admin::AccountAction do
end
end
it 'creates Admin::ActionLog' do
it 'sends notification, log the action, and closes other reports', :aggregate_failures do
other_report = Fabricate(:report, target_account: target_account)
emails = []
expect do
subject
end.to change(Admin::ActionLog, :count).by 1
end
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 'calls process_email!' do
allow(account_action).to receive(:process_email!)
subject
expect(account_action).to have_received(:process_email!)
end
expect(emails).to contain_exactly(
have_attributes(
to: contain_exactly(target_account.user.email)
)
)
it 'calls process_reports!' do
allow(account_action).to receive(:process_reports!)
subject
expect(account_action).to have_received(:process_reports!)
expect(LocalNotificationWorker).to have_enqueued_sidekiq_job(target_account.id, anything, 'AccountWarning', 'moderation_warning')
end
end