2023-02-22 01:55:31 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-06-09 22:46:54 +02:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe AfterBlockDomainFromAccountService, type: :service do
|
2023-06-06 13:58:33 +02:00
|
|
|
subject { described_class.new }
|
2023-02-20 05:24:14 +01:00
|
|
|
|
2018-06-09 22:46:54 +02:00
|
|
|
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
|