Add ability to purge undeliverable domains from admin interface (#16686)
* Add ability to purge undeliverable domains from admin interface * Add tests
This commit is contained in:
parent
0c17fd9109
commit
7f803c41e2
13 changed files with 121 additions and 7 deletions
27
spec/services/purge_domain_service_spec.rb
Normal file
27
spec/services/purge_domain_service_spec.rb
Normal file
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue