about summary refs log tree commit diff
path: root/spec/models
diff options
context:
space:
mode:
authorMatt Jankowski <mjankowski@thoughtbot.com>2017-04-26 14:08:30 -0400
committerEugen Rochko <eugen@zeonfederated.com>2017-04-26 20:08:30 +0200
commitaffd75936e069a28247274683e6015d2b66910c1 (patch)
treeabb6c3ef045a9f96d865e5169235cde24e54b7d7 /spec/models
parent3e78b7cc3a57c9bbf5c9480872b083767d47431c (diff)
Add spec for Status.as_home_timeline (#2451)
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/status_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/models/status_spec.rb b/spec/models/status_spec.rb
index 7923bb293..2674b448c 100644
--- a/spec/models/status_spec.rb
+++ b/spec/models/status_spec.rb
@@ -126,4 +126,31 @@ RSpec.describe Status, type: :model do
   describe '#filter_from_context?' do
     pending
   end
+
+  describe '.as_home_timeline' do
+    before do
+      account = Fabricate(:account)
+      followed = Fabricate(:account)
+      not_followed = Fabricate(:account)
+      Fabricate(:follow, account: account, target_account: followed)
+
+      @self_status = Fabricate(:status, account: account)
+      @followed_status = Fabricate(:status, account: followed)
+      @not_followed_status = Fabricate(:status, account: not_followed)
+
+      @results = Status.as_home_timeline(account)
+    end
+
+    it 'includes statuses from self' do
+      expect(@results).to include(@self_status)
+    end
+
+    it 'includes statuses from followed' do
+      expect(@results).to include(@followed_status)
+    end
+
+    it 'does not include statuses from non-followed' do
+      expect(@results).not_to include(@not_followed_status)
+    end
+  end
 end