diff options
author | Jeong Arm <kjwonmail@gmail.com> | 2022-04-13 00:52:14 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-12 17:52:14 +0200 |
commit | d353bb5ee395bbf65da608b2c5427e655786fb97 (patch) | |
tree | 4b70b799f99ef66cf2bc033cbbd3a17841610646 /spec/models | |
parent | b9b9192432be6b77f8e53138f4f10af298e63edc (diff) |
Implement infinity home timeline (#1610)
* Implement infinity home timeline * Fix test for infinite home timeline * Fix infinity home timeline with min_id * Fix infinite home timeline duplicated statuses * Codeclimate for infinite home timeline * Refactor code as reviewed * Fix redis sufficient check * Fix typo on variable name
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/home_feed_spec.rb | 18 |
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 |