logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe
commit: 30237259367a0ef2b20908518b86bbeb358999b5
parent: 3e4b01b47d4b84b8970048a5a80babdcc681d5c0
Author: ysksn <bluewhale1982@gmail.com>
Date:   Thu, 16 Nov 2017 11:07:27 +0900

Add tests for Status#hidden? (#5719)


Diffstat:

Mspec/models/status_spec.rb30++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+), 0 deletions(-)

diff --git a/spec/models/status_spec.rb b/spec/models/status_spec.rb @@ -69,6 +69,36 @@ RSpec.describe Status, type: :model do end end + describe '#hidden?' do + context 'if private_visibility?' do + it 'returns true' do + subject.visibility = :private + expect(subject.hidden?).to be true + end + end + + context 'if direct_visibility?' do + it 'returns true' do + subject.visibility = :direct + expect(subject.hidden?).to be true + end + end + + context 'if public_visibility?' do + it 'returns false' do + subject.visibility = :public + expect(subject.hidden?).to be false + end + end + + context 'if 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