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.

25 lines
826 B

  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