mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-14 02:44:13 +00:00
Add coverage for CLI::Statuses
command (#25321)
This commit is contained in:
parent
299aa71c8f
commit
00e92b4038
|
@ -4,9 +4,31 @@ require 'rails_helper'
|
||||||
require 'mastodon/cli/statuses'
|
require 'mastodon/cli/statuses'
|
||||||
|
|
||||||
describe Mastodon::CLI::Statuses do
|
describe Mastodon::CLI::Statuses do
|
||||||
|
let(:cli) { described_class.new }
|
||||||
|
|
||||||
describe '.exit_on_failure?' do
|
describe '.exit_on_failure?' do
|
||||||
it 'returns true' do
|
it 'returns true' do
|
||||||
expect(described_class.exit_on_failure?).to be true
|
expect(described_class.exit_on_failure?).to be true
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
|
@ -85,6 +85,12 @@ RSpec.configure do |config|
|
||||||
config.include Redisable
|
config.include Redisable
|
||||||
config.include SignedRequestHelpers, type: :request
|
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
|
config.before :each, type: :cli do
|
||||||
stub_stdout
|
stub_stdout
|
||||||
stub_reset_connection_pools
|
stub_reset_connection_pools
|
||||||
|
|
Loading…
Reference in a new issue