about summary refs log tree commit diff
path: root/spec/models/favourite_spec.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-02-26 15:28:08 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-02-26 15:28:08 +0100
commitf16b31f0773c2fd1122ff0ad98cb392e762f0d0b (patch)
tree24880b7ee107288e7acb540011281569e8502e96 /spec/models/favourite_spec.rb
parent44c5958203dd8d0f96f880a8014a3233719077a6 (diff)
Adding a bunch of tests
Diffstat (limited to 'spec/models/favourite_spec.rb')
-rw-r--r--spec/models/favourite_spec.rb39
1 files changed, 32 insertions, 7 deletions
diff --git a/spec/models/favourite_spec.rb b/spec/models/favourite_spec.rb
index ad803ec4b..c778b13d4 100644
--- a/spec/models/favourite_spec.rb
+++ b/spec/models/favourite_spec.rb
@@ -1,31 +1,56 @@
 require 'rails_helper'
 
 RSpec.describe Favourite, type: :model do
+  let(:alice)  { Fabricate(:account, username: 'alice') }
+  let(:bob)    { Fabricate(:account, username: 'bob') }
+  let(:status) { Fabricate(:status, account: bob) }
+
+  subject { Favourite.new(account: alice, status: status) }
+
   describe '#verb' do
-    pending
+    it 'is always favorite' do
+      expect(subject.verb).to be :favorite
+    end
   end
 
   describe '#title' do
-    pending
+    it 'describes the favourite' do
+      expect(subject.title).to eql 'alice favourited a status by bob'
+    end
   end
 
   describe '#content' do
-    pending
+    it 'equals the title' do
+      expect(subject.content).to eq subject.title
+    end
   end
 
   describe '#object_type' do
-    pending
+    it 'is a note when the target is a note' do
+      expect(subject.object_type).to be :note
+    end
+
+    it 'is a comment when the target is a comment' do
+      status.in_reply_to_id = 2
+      expect(subject.object_type).to be :comment
+    end
   end
 
   describe '#target' do
-    pending
+    it 'is the status that was favourited' do
+      expect(subject.target).to eq status
+    end
   end
 
   describe '#mentions' do
-    pending
+    it 'is always empty' do
+      expect(subject.mentions).to be_empty
+    end
   end
 
   describe '#thread' do
-    pending
+    it 'equals the target' do
+      expect(subject.thread).to eq subject.target
+    end
   end
 end