@ -10,20 +10,17 @@ RSpec.describe AfterBlockDomainFromAccountService do
let ( :alice ) { Fabricate ( :account , username : 'alice' ) }
let ( :alice ) { Fabricate ( :account , username : 'alice' ) }
before do
before do
NotificationPermission . create! ( account : alice , from_account : wolf )
wolf . follow! ( alice )
wolf . follow! ( alice )
alice . follow! ( dog )
alice . follow! ( dog )
end
end
around do | example |
it 'purge followers from blocked domain, remove notification permissions, sends `Reject->Follow`, and records severed relationships' , :aggregate_failures do
Sidekiq :: Testing . fake! do
expect { subject . call ( alice , 'evil.org' ) }
example . run
. to change { wolf . following? ( alice ) } . from ( true ) . to ( false )
end
. and change { NotificationPermission . exists? ( account : alice , from_account : wolf ) } . from ( true ) . to ( false )
end
it 'purges followers from blocked domain, sends them Reject->Follow, and records severed relationships' , :aggregate_failures do
subject . call ( alice , 'evil.org' )
expect ( wolf . following? ( alice ) ) . to be false
expect ( ActivityPub :: DeliveryWorker . jobs . pluck ( 'args' ) ) . to contain_exactly (
expect ( ActivityPub :: DeliveryWorker . jobs . pluck ( 'args' ) ) . to contain_exactly (
[ a_string_including ( '"type":"Reject"' ) , alice . id , wolf . inbox_url ] ,
[ a_string_including ( '"type":"Reject"' ) , alice . id , wolf . inbox_url ] ,
[ a_string_including ( '"type":"Undo"' ) , alice . id , dog . inbox_url ]
[ a_string_including ( '"type":"Undo"' ) , alice . id , dog . inbox_url ]