1
0

after_block_service_spec.rb 903 B

1234567891011121314151617181920212223242526272829
  1. require 'rails_helper'
  2. RSpec.describe AfterBlockService, type: :service do
  3. subject do
  4. -> { described_class.new.call(account, target_account) }
  5. end
  6. let(:account) { Fabricate(:account) }
  7. let(:target_account) { Fabricate(:account) }
  8. describe 'home timeline' do
  9. let(:status) { Fabricate(:status, account: target_account) }
  10. let(:other_account_status) { Fabricate(:status) }
  11. let(:home_timeline_key) { FeedManager.instance.key(:home, account.id) }
  12. before do
  13. Redis.current.del(home_timeline_key)
  14. end
  15. it "clears account's statuses" do
  16. FeedManager.instance.push_to_home(account, status)
  17. FeedManager.instance.push_to_home(account, other_account_status)
  18. is_expected.to change {
  19. Redis.current.zrange(home_timeline_key, 0, -1)
  20. }.from([status.id.to_s, other_account_status.id.to_s]).to([other_account_status.id.to_s])
  21. end
  22. end
  23. end