From dadb759b01ab919c3f3605ce152ae2f5f971d5d6 Mon Sep 17 00:00:00 2001 From: abhishek Tanwar Date: Mon, 11 May 2026 09:44:36 +0530 Subject: [PATCH] spec: apply review feedback for StatusPin callback coverage --- spec/models/status_pin_spec.rb | 35 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/spec/models/status_pin_spec.rb b/spec/models/status_pin_spec.rb index edb3e7964d8..2d279554ae2 100644 --- a/spec/models/status_pin_spec.rb +++ b/spec/models/status_pin_spec.rb @@ -90,6 +90,21 @@ RSpec.describe StatusPin do end end + context 'when the status is missing during destruction' do + subject { Fabricate(:status_pin, account: account) } + + let(:account) { Fabricate :account, domain: nil } + + it 'does not call the invalidator on destroy' do + allow(subject).to receive(:status).and_return(nil) + + expect_any_instance_of(AccountStatusesCleanupPolicy) + .to_not receive(:invalidate_last_inspected) + + subject.destroy + end + end + context 'with a remote account' do let(:account) { Fabricate :account, domain: 'host.example' } @@ -100,24 +115,4 @@ RSpec.describe StatusPin do end end end - - describe 'Private methods' do - describe '#account_matches_status_account?' do - let(:account) { Fabricate(:account) } - - it 'returns false when the status belongs to a different account' do - other_status = Fabricate(:status, account: Fabricate(:account)) - - status_pin = described_class.new(account: account, status: other_status) - - expect(status_pin.send(:account_matches_status_account?)).to be false - end - - it 'returns false when status is nil' do - status_pin = described_class.new(account: account, status: nil) - - expect(status_pin.send(:account_matches_status_account?)).to be false - end - end - end end