From b66fbaeec236b0b666f1de7ae525dec2da40441a Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Wed, 20 Nov 2024 02:52:00 -0500 Subject: [PATCH] Add `AccountWarning` case to `Report#history` spec (#32984) --- spec/models/report_spec.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/spec/models/report_spec.rb b/spec/models/report_spec.rb index a0e4f6fafd..b4fbea437f 100644 --- a/spec/models/report_spec.rb +++ b/spec/models/report_spec.rb @@ -108,15 +108,22 @@ RSpec.describe Report do let(:report) { Fabricate(:report, target_account_id: target_account.id, status_ids: [status.id], created_at: 3.days.ago, updated_at: 1.day.ago) } let(:target_account) { Fabricate(:account) } let(:status) { Fabricate(:status) } + let(:account_warning) { Fabricate(:account_warning, report_id: report.id) } before do Fabricate(:action_log, target_type: 'Report', account_id: target_account.id, target_id: report.id, created_at: 2.days.ago) Fabricate(:action_log, target_type: 'Account', account_id: target_account.id, target_id: report.target_account_id, created_at: 2.days.ago) Fabricate(:action_log, target_type: 'Status', account_id: target_account.id, target_id: status.id, created_at: 2.days.ago) + Fabricate(:action_log, target_type: 'AccountWarning', account_id: target_account.id, target_id: account_warning.id, created_at: 2.days.ago) end - it 'returns right logs' do - expect(action_logs.count).to eq 3 + it 'returns expected logs' do + expect(action_logs) + .to have_attributes(count: 4) + .and include(have_attributes(target_type: 'Account')) + .and include(have_attributes(target_type: 'AccountWarning')) + .and include(have_attributes(target_type: 'Report')) + .and include(have_attributes(target_type: 'Status')) end end