mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-22 14:15:22 +00:00
27 lines
812 B
Ruby
27 lines
812 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'rails_helper'
|
|
|
|
RSpec.describe AfterBlockDomainFromAccountService, type: :service do
|
|
subject { described_class.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
|
|
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
|