logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

precompute_feed_service_spec.rb (1102B)


  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. status = Fabricate(:status, account: account)
  10. subject.call(account)
  11. expect(Redis.current.zscore(FeedManager.instance.key(:home, account.id), status.id)).to be_within(0.1).of(status.id.to_f)
  12. end
  13. it 'does not raise an error even if it could not find any status' do
  14. account = Fabricate(:account)
  15. subject.call(account)
  16. end
  17. it 'filters statuses' do
  18. account = Fabricate(:account)
  19. muted_account = Fabricate(:account)
  20. Fabricate(:mute, account: account, target_account: muted_account)
  21. reblog = Fabricate(:status, account: muted_account)
  22. status = Fabricate(:status, account: account, reblog: reblog)
  23. subject.call(account)
  24. expect(Redis.current.zscore(FeedManager.instance.key(:home, account.id), reblog.id)).to eq nil
  25. end
  26. end
  27. end