2023-05-24 05:55:40 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'rails_helper'
|
|
|
|
require 'mastodon/cli/statuses'
|
|
|
|
|
|
|
|
describe Mastodon::CLI::Statuses do
|
2023-12-07 08:49:14 -05:00
|
|
|
subject { cli.invoke(action, arguments, options) }
|
|
|
|
|
2023-10-16 09:37:22 -04:00
|
|
|
let(:cli) { described_class.new }
|
2023-12-07 08:49:14 -05:00
|
|
|
let(:arguments) { [] }
|
|
|
|
let(:options) { {} }
|
2023-10-16 09:37:22 -04:00
|
|
|
|
2023-12-01 07:00:34 -05:00
|
|
|
it_behaves_like 'CLI Command'
|
2023-10-16 09:37:22 -04:00
|
|
|
|
|
|
|
describe '#remove', use_transactional_tests: false do
|
2023-12-07 08:49:14 -05:00
|
|
|
let(:action) { :remove }
|
|
|
|
|
2023-10-16 09:37:22 -04:00
|
|
|
context 'with small batch size' do
|
|
|
|
let(:options) { { batch_size: 0 } }
|
|
|
|
|
|
|
|
it 'exits with error message' do
|
2023-12-07 08:49:14 -05:00
|
|
|
expect { subject }
|
2024-01-26 03:53:44 -05:00
|
|
|
.to raise_error(Thor::Error, /Cannot run/)
|
2023-10-16 09:37:22 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with default batch size' do
|
|
|
|
it 'removes unreferenced statuses' do
|
2023-12-07 08:49:14 -05:00
|
|
|
expect { subject }
|
|
|
|
.to output_results('Done after')
|
2023-10-16 09:37:22 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2023-05-24 05:55:40 -04:00
|
|
|
end
|