闭社主体 forked from https://github.com/tootsuite/mastodon
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.

27 lines
835 B

  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe PrecomputeFeedService do
  4. subject { PrecomputeFeedService.new }
  5. describe 'call' do
  6. let(:account) { Fabricate(:account) }
  7. it 'fills a user timeline with statuses' do
  8. account = Fabricate(:account)
  9. followed_account = Fabricate(:account)
  10. Fabricate(:follow, account: account, target_account: followed_account)
  11. reblog = Fabricate(:status, account: followed_account)
  12. status = Fabricate(:status, account: account, reblog: reblog)
  13. subject.call(account)
  14. expect(Redis.current.zscore(FeedManager.instance.key(:home, account.id), reblog.id)).to eq status.id
  15. end
  16. it 'does not raise an error even if it could not find any status' do
  17. account = Fabricate(:account)
  18. subject.call(account)
  19. end
  20. end
  21. end