]> cat aescling's git repositories - mastodon.git/commitdiff
Add tests for Status#verb (#5717)
authorysksn <bluewhale1982@gmail.com>
Thu, 16 Nov 2017 06:46:29 +0000 (15:46 +0900)
committerYamagishi Kazutoshi <ykzts@desire.sh>
Thu, 16 Nov 2017 06:46:29 +0000 (15:46 +0900)
spec/models/status_spec.rb

index 0b8ed66f6ea67147137b18a2755ae3aed9bfe268..d58ff501926138f3c08177467e507830f74f5481 100644 (file)
@@ -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