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.
glitchier-soc/spec/services/after_block_domain_from_acc...

26 lines
826 B

require 'rails_helper'
RSpec.describe AfterBlockDomainFromAccountService, type: :service do
subject { AfterBlockDomainFromAccountService.new }
let!(:wolf) { Fabricate(:account, username: 'wolf', domain: 'evil.org', inbox_url: 'https://evil.org/inbox', protocol: :activitypub) }
let!(:alice) { Fabricate(:account, username: 'alice') }
before do
stub_jsonld_contexts!
allow(ActivityPub::DeliveryWorker).to receive(:perform_async)
end
it 'purge followers from blocked domain' do
wolf.follow!(alice)
subject.call(alice, 'evil.org')
expect(wolf.following?(alice)).to be false
end
it 'sends Reject->Follow to followers from blocked domain' do
wolf.follow!(alice)
subject.call(alice, 'evil.org')
expect(ActivityPub::DeliveryWorker).to have_received(:perform_async).once
end
end