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.

30 lines
992 B

  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe RefollowWorker do
  4. subject { described_class.new }
  5. let(:account) { Fabricate(:account, domain: 'example.org', protocol: :activitypub) }
  6. let(:alice) { Fabricate(:account, domain: nil, username: 'alice') }
  7. let(:bob) { Fabricate(:account, domain: nil, username: 'bob') }
  8. describe 'perform' do
  9. let(:service) { double }
  10. before do
  11. allow(FollowService).to receive(:new).and_return(service)
  12. allow(service).to receive(:call)
  13. alice.follow!(account, reblogs: true)
  14. bob.follow!(account, reblogs: false)
  15. end
  16. it 'calls FollowService for local followers' do
  17. result = subject.perform(account.id)
  18. expect(result).to be_nil
  19. expect(service).to have_received(:call).with(alice, account, reblogs: true, notify: false, bypass_limit: true)
  20. expect(service).to have_received(:call).with(bob, account, reblogs: false, notify: false, bypass_limit: true)
  21. end
  22. end
  23. end