Add spec coverage for CLI::Media#lookup command (#28266)

This commit is contained in:
Matt Jankowski 2023-12-07 10:27:41 -05:00 committed by GitHub
parent 3918dc68c7
commit 8d8ae05a18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -89,6 +89,32 @@ describe Mastodon::CLI::Media do
end end
end end
describe '#lookup' do
let(:action) { :lookup }
let(:arguments) { [url] }
context 'with valid url not connected to a record' do
let(:url) { 'https://example.host/assets/1' }
it 'warns about url and exits' do
expect { subject }
.to output_results('Not a media URL')
.and raise_error(SystemExit)
end
end
context 'with a valid media url' do
let(:status) { Fabricate(:status) }
let(:media_attachment) { Fabricate(:media_attachment, status: status) }
let(:url) { media_attachment.file.url(:original) }
it 'displays the url of a connected status' do
expect { subject }
.to output_results(status.id.to_s)
end
end
end
describe '#refresh' do describe '#refresh' do
let(:action) { :refresh } let(:action) { :refresh }