2023-05-24 19:55:40 +10:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'rails_helper'
|
|
|
|
require 'mastodon/cli/domains'
|
|
|
|
|
|
|
|
describe Mastodon::CLI::Domains do
|
2023-12-04 20:09:05 +11:00
|
|
|
let(:cli) { described_class.new }
|
|
|
|
|
2023-12-01 23:00:34 +11:00
|
|
|
it_behaves_like 'CLI Command'
|
2023-12-04 20:09:05 +11:00
|
|
|
|
|
|
|
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
|
2023-05-24 19:55:40 +10:00
|
|
|
end
|