about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
authorJenkins <jenkins@jenkins.ninjawedding.org>2017-11-19 15:17:12 +0000
committerJenkins <jenkins@jenkins.ninjawedding.org>2017-11-19 15:17:12 +0000
commita36a2c17964ee4cb3b1d6471769e765db0d9f90d (patch)
tree8766f192e2ce8c3eac4312490bad7b33f5a2623b /spec
parente45cb0837bcefecfecf3ef39bbdee721a47a79fd (diff)
parent2bcc81700c586a543e849e222c640df89da7fcb0 (diff)
Merge remote-tracking branch 'tootsuite/master' into glitchsoc/master
Diffstat (limited to 'spec')
-rw-r--r--spec/models/notification_spec.rb31
1 files changed, 12 insertions, 19 deletions
diff --git a/spec/models/notification_spec.rb b/spec/models/notification_spec.rb
index 763b1523f..8444c8f63 100644
--- a/spec/models/notification_spec.rb
+++ b/spec/models/notification_spec.rb
@@ -6,23 +6,18 @@ RSpec.describe Notification, type: :model do
   end
 
   describe '#target_status' do
-    before do
-      allow(notification).to receive(:type).and_return(type)
-      allow(notification).to receive(:activity).and_return(activity)
-    end
-
-    let(:notification) { Fabricate(:notification) }
-    let(:status)       { instance_double('Status') }
-    let(:favourite)    { instance_double('Favourite') }
-    let(:mention)      { instance_double('Mention') }
+    let(:notification) { Fabricate(:notification, activity_type: type, activity: activity) }
+    let(:status)       { Fabricate(:status) }
+    let(:reblog)       { Fabricate(:status, reblog: status) }
+    let(:favourite)    { Fabricate(:favourite, status: status) }
+    let(:mention)      { Fabricate(:mention, status: status) }
 
     context 'type is :reblog' do
       let(:type)     { :reblog }
-      let(:activity) { status }
+      let(:activity) { reblog }
 
-      it 'calls activity.reblog' do
-        expect(activity).to receive(:reblog)
-        notification.target_status
+      it 'returns status' do
+        expect(notification.target_status).to eq status
       end
     end
 
@@ -30,9 +25,8 @@ RSpec.describe Notification, type: :model do
       let(:type)     { :favourite }
       let(:activity) { favourite }
 
-      it 'calls activity.status' do
-        expect(activity).to receive(:status)
-        notification.target_status
+      it 'returns status' do
+        expect(notification.target_status).to eq status
       end
     end
 
@@ -40,9 +34,8 @@ RSpec.describe Notification, type: :model do
       let(:type)     { :mention }
       let(:activity) { mention }
 
-      it 'calls activity.status' do
-        expect(activity).to receive(:status)
-        notification.target_status
+      it 'returns status' do
+        expect(notification.target_status).to eq status
       end
     end
   end