2023-05-24 18:55:40 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'rails_helper'
|
|
|
|
require 'mastodon/cli/statuses'
|
|
|
|
|
|
|
|
describe Mastodon::CLI::Statuses do
|
2023-10-16 22:37:22 +09:00
|
|
|
let(:cli) { described_class.new }
|
|
|
|
|
2023-12-01 21:00:34 +09:00
|
|
|
it_behaves_like 'CLI Command'
|
2023-10-16 22:37:22 +09:00
|
|
|
|
|
|
|
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
|
2023-05-24 18:55:40 +09:00
|
|
|
end
|