diff options
author | Claire <claire.github-309c@sitedethib.com> | 2021-12-17 23:01:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-17 23:01:21 +0100 |
commit | 7f803c41e2ca54b7b787b1f111f91357136c0e68 (patch) | |
tree | 4583b08c706ac25f05be5dc2908d52a55a71c81a /spec/services | |
parent | 0c17fd91091fd2f230224d5fce218688d480502c (diff) |
Add ability to purge undeliverable domains from admin interface (#16686)
* Add ability to purge undeliverable domains from admin interface * Add tests
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/purge_domain_service_spec.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/services/purge_domain_service_spec.rb b/spec/services/purge_domain_service_spec.rb new file mode 100644 index 000000000..59285f126 --- /dev/null +++ b/spec/services/purge_domain_service_spec.rb @@ -0,0 +1,27 @@ +require 'rails_helper' + +RSpec.describe PurgeDomainService, type: :service do + let!(:old_account) { Fabricate(:account, domain: 'obsolete.org') } + let!(:old_status1) { Fabricate(:status, account: old_account) } + let!(:old_status2) { Fabricate(:status, account: old_account) } + let!(:old_attachment) { Fabricate(:media_attachment, account: old_account, status: old_status2, file: attachment_fixture('attachment.jpg')) } + + subject { PurgeDomainService.new } + + describe 'for a suspension' do + before do + subject.call('obsolete.org') + end + + it 'removes the remote accounts\'s statuses and media attachments' do + expect { old_account.reload }.to raise_exception ActiveRecord::RecordNotFound + expect { old_status1.reload }.to raise_exception ActiveRecord::RecordNotFound + expect { old_status2.reload }.to raise_exception ActiveRecord::RecordNotFound + expect { old_attachment.reload }.to raise_exception ActiveRecord::RecordNotFound + end + + it 'refreshes instances view' do + expect(Instance.where(domain: 'obsolete.org').exists?).to be false + end + end +end |