Add Status::Visibility
concern to hold visibility logic (#33578)
This commit is contained in:
parent
7c56517c7c
commit
50013b10a5
4 changed files with 234 additions and 56 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue