diff options
author | Jenkins <jenkins@jenkins.ninjawedding.org> | 2018-06-12 13:17:21 +0000 |
---|---|---|
committer | Jenkins <jenkins@jenkins.ninjawedding.org> | 2018-06-12 13:17:21 +0000 |
commit | 4d8d1fa129b5f8692311de211203bc18c614951f (patch) | |
tree | e9a1130c9a9e5a5b8babd2ba3153e4ed03a4581e /spec/services | |
parent | 34f1fd2a621ca869c17009487e2f10063812fbd0 (diff) | |
parent | 6151308c47efb0e05bcb2c54aa1693f5ff04da5c (diff) |
Merge remote-tracking branch 'tootsuite/master' into glitchsoc/master
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/after_block_domain_from_account_service_spec.rb | 25 | ||||
-rw-r--r-- | spec/services/block_domain_from_account_service_spec.rb | 19 |
2 files changed, 25 insertions, 19 deletions
diff --git a/spec/services/after_block_domain_from_account_service_spec.rb b/spec/services/after_block_domain_from_account_service_spec.rb new file mode 100644 index 000000000..006e3f4d2 --- /dev/null +++ b/spec/services/after_block_domain_from_account_service_spec.rb @@ -0,0 +1,25 @@ +require 'rails_helper' + +RSpec.describe AfterBlockDomainFromAccountService, type: :service do + let!(:wolf) { Fabricate(:account, username: 'wolf', domain: 'evil.org', inbox_url: 'https://evil.org/inbox', protocol: :activitypub) } + let!(:alice) { Fabricate(:account, username: 'alice') } + + subject { AfterBlockDomainFromAccountService.new } + + 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 diff --git a/spec/services/block_domain_from_account_service_spec.rb b/spec/services/block_domain_from_account_service_spec.rb deleted file mode 100644 index 365c0a4ad..000000000 --- a/spec/services/block_domain_from_account_service_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -require 'rails_helper' - -RSpec.describe BlockDomainFromAccountService, type: :service do - let!(:wolf) { Fabricate(:account, username: 'wolf', domain: 'evil.org') } - let!(:alice) { Fabricate(:account, username: 'alice') } - - subject { BlockDomainFromAccountService.new } - - it 'creates domain block' do - subject.call(alice, 'evil.org') - expect(alice.domain_blocking?('evil.org')).to be true - end - - it 'purge followers from blocked domain' do - wolf.follow!(alice) - subject.call(alice, 'evil.org') - expect(wolf.following?(alice)).to be false - end -end |