From 1bf2230fd1a25a1f8c012e4ff70c08a0a48d88d3 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Mon, 4 Dec 2023 04:08:47 -0500 Subject: [PATCH] Add spec coverage for `CLI::Upgrade#storage_schema` command (#28180) --- spec/lib/mastodon/cli/upgrade_spec.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/spec/lib/mastodon/cli/upgrade_spec.rb b/spec/lib/mastodon/cli/upgrade_spec.rb index 817044f7ea..0d6494eeee 100644 --- a/spec/lib/mastodon/cli/upgrade_spec.rb +++ b/spec/lib/mastodon/cli/upgrade_spec.rb @@ -4,5 +4,24 @@ require 'rails_helper' require 'mastodon/cli/upgrade' describe Mastodon::CLI::Upgrade do + let(:cli) { described_class.new } + it_behaves_like 'CLI Command' + + describe '#storage_schema' do + context 'with records that dont need upgrading' do + let(:options) { {} } + + before do + Fabricate(:account) + Fabricate(:media_attachment) + end + + it 'does not upgrade storage for the attachments' do + expect { cli.invoke(:storage_schema, [], options) }.to output( + a_string_including('Upgraded storage schema of 0 records') + ).to_stdout + end + end + end end