0
0
Fork 0

Add Status::Visibility concern to hold visibility logic (#33578)

This commit is contained in:
Matt Jankowski 2025-01-14 09:32:57 -05:00 committed by GitHub
parent 7c56517c7c
commit 50013b10a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 234 additions and 56 deletions

View file

@ -9,6 +9,8 @@ RSpec.describe Status do
let(:bob) { Fabricate(:account, username: 'bob') }
let(:other) { Fabricate(:status, account: bob, text: 'Skulls for the skull god! The enemy\'s gates are sideways!') }
include_examples 'Status::Visibility'
describe '#local?' do
it 'returns true when no remote URI is set' do
expect(subject.local?).to be true
@ -84,36 +86,6 @@ RSpec.describe Status do
end
end
describe '#hidden?' do
context 'when private_visibility?' do
it 'returns true' do
subject.visibility = :private
expect(subject.hidden?).to be true
end
end
context 'when direct_visibility?' do
it 'returns true' do
subject.visibility = :direct
expect(subject.hidden?).to be true
end
end
context 'when public_visibility?' do
it 'returns false' do
subject.visibility = :public
expect(subject.hidden?).to be false
end
end
context 'when unlisted_visibility?' do
it 'returns false' do
subject.visibility = :unlisted
expect(subject.hidden?).to be false
end
end
end
describe '#content' do
it 'returns the text of the status if it is not a reblog' do
expect(subject.content).to eql subject.text