2023-05-24 11:55:40 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'rails_helper'
|
|
|
|
require 'mastodon/cli/upgrade'
|
|
|
|
|
|
|
|
describe Mastodon::CLI::Upgrade do
|
2023-12-07 14:49:14 +01:00
|
|
|
subject { cli.invoke(action, arguments, options) }
|
|
|
|
|
2023-12-04 10:08:47 +01:00
|
|
|
let(:cli) { described_class.new }
|
2023-12-07 14:49:14 +01:00
|
|
|
let(:arguments) { [] }
|
|
|
|
let(:options) { {} }
|
2023-12-04 10:08:47 +01:00
|
|
|
|
2023-12-01 13:00:34 +01:00
|
|
|
it_behaves_like 'CLI Command'
|
2023-12-04 10:08:47 +01:00
|
|
|
|
|
|
|
describe '#storage_schema' do
|
2023-12-07 14:49:14 +01:00
|
|
|
let(:action) { :storage_schema }
|
2023-12-04 10:08:47 +01:00
|
|
|
|
2023-12-07 14:49:14 +01:00
|
|
|
context 'with records that dont need upgrading' do
|
2023-12-04 10:08:47 +01:00
|
|
|
before do
|
|
|
|
Fabricate(:account)
|
|
|
|
Fabricate(:media_attachment)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not upgrade storage for the attachments' do
|
2023-12-07 14:49:14 +01:00
|
|
|
expect { subject }
|
|
|
|
.to output_results('Upgraded storage schema of 0 records')
|
2023-12-04 10:08:47 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2023-05-24 11:55:40 +02:00
|
|
|
end
|