Skip to content

Commit

Permalink
Add coverage for --days option to CLI media refresh command (mast…
Browse files Browse the repository at this point in the history
  • Loading branch information
mjankowski authored Jan 10, 2024
1 parent a71e918 commit 742d8d3
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions spec/lib/mastodon/cli/media_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,21 @@
.to output_results('Downloaded 1 media')
end
end

context 'with --days option' do
before do
Fabricate(:media_attachment, remote_url: 'https://example.com/image.jpg', id: Mastodon::Snowflake.id_at(50.days.ago))
Fabricate(:media_attachment, remote_url: 'https://example.com/image.jpg', id: Mastodon::Snowflake.id_at(5.days.ago))
Fabricate(:media_attachment, remote_url: '', id: Mastodon::Snowflake.id_at(5.days.ago))
end

let(:options) { { days: 10 } }

it 'redownloads the attachment file for the remote records more recent than the option' do
expect { subject }
.to output_results('Downloaded 1 media')
end
end
end

describe '#remove_orphans' do
Expand Down

0 comments on commit 742d8d3

Please sign in to comment.