The code powering m.abunchtell.com https://m.abunchtell.com
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 

22 行
768 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, maintining the order from Redis" 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 = double(zrevrangebyscore: [["val2", 2.0], ["val1", 1.0], ["val3", 3.0], ["deleted", 4.0]])
  11. allow(Redis).to receive(:current).and_return(redis)
  12. feed = Feed.new("type", account)
  13. results = feed.get(3)
  14. expect(results.map(&:id)).to eq [2, 1, 3]
  15. expect(results.first.attributes.keys).to eq ["id", "updated_at"]
  16. end
  17. end
  18. end