Formalize some patterns in cli specs (#28255)
This commit is contained in:
parent
5d97a897c8
commit
ad34d33bfd
17 changed files with 492 additions and 449 deletions
|
@ -4,26 +4,31 @@ require 'rails_helper'
|
|||
require 'mastodon/cli/statuses'
|
||||
|
||||
describe Mastodon::CLI::Statuses do
|
||||
subject { cli.invoke(action, arguments, options) }
|
||||
|
||||
let(:cli) { described_class.new }
|
||||
let(:arguments) { [] }
|
||||
let(:options) { {} }
|
||||
|
||||
it_behaves_like 'CLI Command'
|
||||
|
||||
describe '#remove', use_transactional_tests: false do
|
||||
let(:action) { :remove }
|
||||
|
||||
context 'with small batch size' do
|
||||
let(:options) { { batch_size: 0 } }
|
||||
|
||||
it 'exits with error message' do
|
||||
expect { cli.invoke :remove, [], options }.to output(
|
||||
a_string_including('Cannot run')
|
||||
).to_stdout.and raise_error(SystemExit)
|
||||
expect { subject }
|
||||
.to output_results('Cannot run')
|
||||
.and raise_error(SystemExit)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with default batch size' do
|
||||
it 'removes unreferenced statuses' do
|
||||
expect { cli.invoke :remove }.to output(
|
||||
a_string_including('Done after')
|
||||
).to_stdout
|
||||
expect { subject }
|
||||
.to output_results('Done after')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue