after_block_domain_from_account_service_spec.rb 826 B

12345678910111213141516171819202122232425
  1. require 'rails_helper'
  2. RSpec.describe AfterBlockDomainFromAccountService, type: :service do
  3. let!(:wolf) { Fabricate(:account, username: 'wolf', domain: 'evil.org', inbox_url: 'https://evil.org/inbox', protocol: :activitypub) }
  4. let!(:alice) { Fabricate(:account, username: 'alice') }
  5. subject { AfterBlockDomainFromAccountService.new }
  6. before do
  7. stub_jsonld_contexts!
  8. allow(ActivityPub::DeliveryWorker).to receive(:perform_async)
  9. end
  10. it 'purge followers from blocked domain' do
  11. wolf.follow!(alice)
  12. subject.call(alice, 'evil.org')
  13. expect(wolf.following?(alice)).to be false
  14. end
  15. it 'sends Reject->Follow to followers from blocked domain' do
  16. wolf.follow!(alice)
  17. subject.call(alice, 'evil.org')
  18. expect(ActivityPub::DeliveryWorker).to have_received(:perform_async).once
  19. end
  20. end