mirror of
https://github.com/mastodon/mastodon.git
synced 2026-09-15 08:36:36 -05:00
spec: apply review feedback for StatusPin callback coverage
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user