Add spec coverage for `CLI::Domains#purge` command (#28179)
This commit is contained in:
parent
1bf2230fd1
commit
9603198982
|
@ -4,5 +4,22 @@ require 'rails_helper'
|
||||||
require 'mastodon/cli/domains'
|
require 'mastodon/cli/domains'
|
||||||
|
|
||||||
describe Mastodon::CLI::Domains do
|
describe Mastodon::CLI::Domains do
|
||||||
|
let(:cli) { described_class.new }
|
||||||
|
|
||||||
it_behaves_like 'CLI Command'
|
it_behaves_like 'CLI Command'
|
||||||
|
|
||||||
|
describe '#purge' do
|
||||||
|
context 'with accounts from the domain' do
|
||||||
|
let(:options) { {} }
|
||||||
|
let(:domain) { 'host.example' }
|
||||||
|
let!(:account) { Fabricate(:account, domain: domain) }
|
||||||
|
|
||||||
|
it 'removes the account' do
|
||||||
|
expect { cli.invoke(:purge, [domain], options) }.to output(
|
||||||
|
a_string_including('Removed 1 accounts')
|
||||||
|
).to_stdout
|
||||||
|
expect { account.reload }.to raise_error(ActiveRecord::RecordNotFound)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue