about summary refs log tree commit diff
path: root/spec/models/home_feed_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/home_feed_spec.rb')
-rw-r--r--spec/models/home_feed_spec.rb18
1 files changed, 14 insertions, 4 deletions
diff --git a/spec/models/home_feed_spec.rb b/spec/models/home_feed_spec.rb
index ee7a83960..179459e53 100644
--- a/spec/models/home_feed_spec.rb
+++ b/spec/models/home_feed_spec.rb
@@ -21,12 +21,17 @@ RSpec.describe HomeFeed, type: :model do
         )
       end
 
-      it 'gets statuses with ids in the range from redis' do
+      it 'gets statuses with ids in the range from redis with database' do
         results = subject.get(3)
 
-        expect(results.map(&:id)).to eq [3, 2]
+        expect(results.map(&:id)).to eq [3, 2, 1]
         expect(results.first.attributes.keys).to eq %w(id updated_at)
       end
+
+      it 'with min_id present' do
+        results = subject.get(3, nil, nil, 0)
+        expect(results.map(&:id)).to eq [3, 2, 1]
+      end
     end
 
     context 'when feed is being generated' do
@@ -34,10 +39,15 @@ RSpec.describe HomeFeed, type: :model do
         Redis.current.set("account:#{account.id}:regeneration", true)
       end
 
-      it 'returns nothing' do
+      it 'returns from database' do
         results = subject.get(3)
 
-        expect(results.map(&:id)).to eq []
+        expect(results.map(&:id)).to eq [10, 3, 2]
+      end
+
+      it 'with min_id present' do
+        results = subject.get(3, nil, nil, 0)
+        expect(results.map(&:id)).to eq [3, 2, 1]
       end
     end
   end