Add coverage for CLI::Statuses
command (#25321)
This commit is contained in:
parent
299aa71c8f
commit
00e92b4038
2 changed files with 28 additions and 0 deletions
|
@ -4,9 +4,31 @@ require 'rails_helper'
|
|||
require 'mastodon/cli/statuses'
|
||||
|
||||
describe Mastodon::CLI::Statuses do
|
||||
let(:cli) { described_class.new }
|
||||
|
||||
describe '.exit_on_failure?' do
|
||||
it 'returns true' do
|
||||
expect(described_class.exit_on_failure?).to be true
|
||||
end
|
||||
end
|
||||
|
||||
describe '#remove', use_transactional_tests: false do
|
||||
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)
|
||||
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
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -85,6 +85,12 @@ RSpec.configure do |config|
|
|||
config.include Redisable
|
||||
config.include SignedRequestHelpers, type: :request
|
||||
|
||||
config.around(:each, use_transactional_tests: false) do |example|
|
||||
self.use_transactional_tests = false
|
||||
example.run
|
||||
self.use_transactional_tests = true
|
||||
end
|
||||
|
||||
config.before :each, type: :cli do
|
||||
stub_stdout
|
||||
stub_reset_connection_pools
|
||||
|
|
Loading…
Reference in a new issue