about summary refs log tree commit diff
diff options
context:
space:
mode:
authorysksn <bluewhale1982@gmail.com>2017-11-16 15:46:29 +0900
committerYamagishi Kazutoshi <ykzts@desire.sh>2017-11-16 15:46:29 +0900
commit556c07df1f30482782cd94070d23b31ffdefca89 (patch)
tree2c2a6cc7cbf9e6378748385489a258576c011b09
parent30237259367a0ef2b20908518b86bbeb358999b5 (diff)
Add tests for Status#verb (#5717)
-rw-r--r--spec/models/status_spec.rb23
1 files changed, 21 insertions, 2 deletions
diff --git a/spec/models/status_spec.rb b/spec/models/status_spec.rb
index 0b8ed66f6..d58ff5019 100644
--- a/spec/models/status_spec.rb
+++ b/spec/models/status_spec.rb
@@ -47,8 +47,27 @@ RSpec.describe Status, type: :model do
   end
 
   describe '#verb' do
-    it 'is always post' do
-      expect(subject.verb).to be :post
+    context 'if destroyed?' do
+      it 'returns :delete' do
+        subject.destroy!
+        expect(subject.verb).to be :delete
+      end
+    end
+
+    context 'unless destroyed?' do
+      context 'if reblog?' do
+        it 'returns :share' do
+          subject.reblog = other
+          expect(subject.verb).to be :share
+        end
+      end
+
+      context 'unless reblog?' do
+        it 'returns :post' do
+          subject.reblog = nil
+          expect(subject.verb).to be :post
+        end
+      end
     end
   end