2023-05-24 05:55:40 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'rails_helper'
|
|
|
|
require 'mastodon/cli/domains'
|
|
|
|
|
|
|
|
describe Mastodon::CLI::Domains do
|
2023-12-07 08:49:14 -05:00
|
|
|
subject { cli.invoke(action, arguments, options) }
|
|
|
|
|
2023-12-04 04:09:05 -05:00
|
|
|
let(:cli) { described_class.new }
|
2023-12-07 08:49:14 -05:00
|
|
|
let(:arguments) { [] }
|
|
|
|
let(:options) { {} }
|
2023-12-04 04:09:05 -05:00
|
|
|
|
2023-12-01 07:00:34 -05:00
|
|
|
it_behaves_like 'CLI Command'
|
2023-12-04 04:09:05 -05:00
|
|
|
|
|
|
|
describe '#purge' do
|
2023-12-07 08:49:14 -05:00
|
|
|
let(:action) { :purge }
|
|
|
|
|
2023-12-04 04:09:05 -05:00
|
|
|
context 'with accounts from the domain' do
|
|
|
|
let(:domain) { 'host.example' }
|
|
|
|
let!(:account) { Fabricate(:account, domain: domain) }
|
2023-12-07 08:49:14 -05:00
|
|
|
let(:arguments) { [domain] }
|
2023-12-04 04:09:05 -05:00
|
|
|
|
|
|
|
it 'removes the account' do
|
2023-12-07 08:49:14 -05:00
|
|
|
expect { subject }
|
|
|
|
.to output_results('Removed 1 accounts')
|
|
|
|
|
2023-12-04 04:09:05 -05:00
|
|
|
expect { account.reload }.to raise_error(ActiveRecord::RecordNotFound)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2023-05-24 05:55:40 -04:00
|
|
|
end
|