0
0
Fork 0

Formalize some patterns in cli specs (#28255)

This commit is contained in:
Matt Jankowski 2023-12-07 08:49:14 -05:00 committed by GitHub
parent 5d97a897c8
commit ad34d33bfd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 492 additions and 449 deletions

View file

@ -4,20 +4,26 @@ require 'rails_helper'
require 'mastodon/cli/domains'
describe Mastodon::CLI::Domains do
subject { cli.invoke(action, arguments, options) }
let(:cli) { described_class.new }
let(:arguments) { [] }
let(:options) { {} }
it_behaves_like 'CLI Command'
describe '#purge' do
let(:action) { :purge }
context 'with accounts from the domain' do
let(:options) { {} }
let(:domain) { 'host.example' }
let!(:account) { Fabricate(:account, domain: domain) }
let(:arguments) { [domain] }
it 'removes the account' do
expect { cli.invoke(:purge, [domain], options) }.to output(
a_string_including('Removed 1 accounts')
).to_stdout
expect { subject }
.to output_results('Removed 1 accounts')
expect { account.reload }.to raise_error(ActiveRecord::RecordNotFound)
end
end