about summary refs log tree commit diff
path: root/spec/models/status_spec.rb
diff options
context:
space:
mode:
authorysksn <bluewhale1982@gmail.com>2017-11-16 11:07:27 +0900
committerYamagishi Kazutoshi <ykzts@desire.sh>2017-11-16 11:07:27 +0900
commit30237259367a0ef2b20908518b86bbeb358999b5 (patch)
tree973fe6ef87e72db73fc93fc4167076d9d8aa686a /spec/models/status_spec.rb
parent3e4b01b47d4b84b8970048a5a80babdcc681d5c0 (diff)
Add tests for Status#hidden? (#5719)
Diffstat (limited to 'spec/models/status_spec.rb')
-rw-r--r--spec/models/status_spec.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/models/status_spec.rb b/spec/models/status_spec.rb
index 9cb71d715..0b8ed66f6 100644
--- 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