You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
717 B

  1. require 'rails_helper'
  2. RSpec.describe Feed, type: :model do
  3. describe '#get' do
  4. it 'gets statuses with ids in the range' do
  5. account = Fabricate(:account)
  6. Fabricate(:status, account: account, id: 1)
  7. Fabricate(:status, account: account, id: 2)
  8. Fabricate(:status, account: account, id: 3)
  9. Fabricate(:status, account: account, id: 10)
  10. Redis.current.zadd(FeedManager.instance.key(:home, account.id),
  11. [[4, 'deleted'], [3, 'val3'], [2, 'val2'], [1, 'val1']])
  12. feed = Feed.new(:home, account)
  13. results = feed.get(3)
  14. expect(results.map(&:id)).to eq [3, 2]
  15. expect(results.first.attributes.keys).to eq %w(id updated_at)
  16. end
  17. end
  18. end