mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-13 15:58:50 +00:00
Bust CDN cache on media deletion (#31353)
This commit is contained in:
@@ -292,6 +292,25 @@ RSpec.describe MediaAttachment, :attachment_processing do
|
||||
end
|
||||
end
|
||||
|
||||
describe 'cache deletion hooks' do
|
||||
let(:media) { Fabricate(:media_attachment) }
|
||||
|
||||
before do
|
||||
allow(Rails.configuration.x).to receive(:cache_buster_enabled).and_return(true)
|
||||
end
|
||||
|
||||
it 'queues CacheBusterWorker jobs' do
|
||||
original_path = media.file.path(:original)
|
||||
small_path = media.file.path(:small)
|
||||
thumbnail_path = media.thumbnail.path(:original)
|
||||
|
||||
expect { media.destroy }
|
||||
.to enqueue_sidekiq_job(CacheBusterWorker).with(original_path)
|
||||
.and enqueue_sidekiq_job(CacheBusterWorker).with(small_path)
|
||||
.and enqueue_sidekiq_job(CacheBusterWorker).with(thumbnail_path)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def media_metadata
|
||||
|
||||
Reference in New Issue
Block a user