Update bust_tag to EdgeCache::BustTag (#11953)

This commit is contained in:
Alex 2020-12-21 14:43:42 -05:00 committed by GitHub
parent e9886d106c
commit d0c70e72d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -4,7 +4,7 @@ module Tags
tag = Tag.find_by(name: tag_name)
return unless tag
CacheBuster.bust_tag(tag)
EdgeCache::BustTag.call(tag)
end
end
end

View file

@ -3,26 +3,26 @@ require "rails_helper"
RSpec.describe Tags::BustCacheWorker, type: :worker do
let(:worker) { subject }
before { allow(CacheBuster).to receive(:bust_tag) }
# Passing in random tag
include_examples "#enqueues_on_correct_queue", "high_priority", ["php"]
describe "#perform_now" do
it "busts cache" do
tag = create(:tag)
allow(EdgeCache::BustTag).to receive(:call).with(tag)
worker.perform(tag.name)
expect(CacheBuster).to have_received(:bust_tag).with(tag)
expect(EdgeCache::BustTag).to have_received(:call).with(tag)
end
it "doesn't call the cache buster if the tag does not exist" do
allow(EdgeCache::BustTag).to receive(:call)
tag_name = "definitelyatagthatdoesnotexist"
worker.perform(tag_name)
expect(CacheBuster).not_to have_received(:bust_tag)
expect(EdgeCache::BustTag).not_to have_received(:call)
end
end
end