mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-25 17:51:36 +01:00
Add basic coverage for RemoveDomainsFromFollowersService
class (#29327)
This commit is contained in:
parent
7c7dfe7de3
commit
e9b0f0c314
1 changed files with 28 additions and 0 deletions
28
spec/services/remove_domains_from_followers_service_spec.rb
Normal file
28
spec/services/remove_domains_from_followers_service_spec.rb
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe RemoveDomainsFromFollowersService do
|
||||||
|
describe '#call' do
|
||||||
|
context 'with account followers' do
|
||||||
|
let(:account) { Fabricate(:account, domain: nil) }
|
||||||
|
let(:good_domain_account) { Fabricate(:account, domain: 'good.example', protocol: :activitypub) }
|
||||||
|
let(:bad_domain_account) { Fabricate(:account, domain: 'bad.example', protocol: :activitypub) }
|
||||||
|
|
||||||
|
before do
|
||||||
|
Fabricate :follow, target_account: account, account: good_domain_account
|
||||||
|
Fabricate :follow, target_account: account, account: bad_domain_account
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'removes followers from supplied domains and sends a notification' do
|
||||||
|
subject.call(account, ['bad.example'])
|
||||||
|
|
||||||
|
expect(account.followers)
|
||||||
|
.to include(good_domain_account)
|
||||||
|
.and not_include(bad_domain_account)
|
||||||
|
expect(ActivityPub::DeliveryWorker)
|
||||||
|
.to have_enqueued_sidekiq_job(anything, account.id, bad_domain_account.inbox_url)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue