From 2381ed55d7b62267101c1e64b9193caa897a0595 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Mon, 2 Dec 2024 16:52:12 -0500 Subject: [PATCH] Add coverage for `Report#unresolved_siblings?` (#33141) --- spec/models/report_spec.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/spec/models/report_spec.rb b/spec/models/report_spec.rb index b4fbea437f..e62b2e9094 100644 --- a/spec/models/report_spec.rb +++ b/spec/models/report_spec.rb @@ -127,6 +127,28 @@ RSpec.describe Report do end end + describe '#unresolved_siblings?' do + subject { Fabricate :report } + + context 'when the target account has other unresolved reports' do + before { Fabricate :report, action_taken_at: nil, target_account: subject.target_account } + + it { is_expected.to be_unresolved_siblings } + end + + context 'when the target account has a resolved report' do + before { Fabricate :report, action_taken_at: 3.days.ago, target_account: subject.target_account } + + it { is_expected.to_not be_unresolved_siblings } + end + + context 'when the target account has no other reports' do + before { described_class.where(target_account: subject.target_account).destroy_all } + + it { is_expected.to_not be_unresolved_siblings } + end + end + describe 'validations' do let(:remote_account) { Fabricate(:account, domain: 'example.com', protocol: :activitypub, inbox_url: 'http://example.com/inbox') }