docbrown/spec/services/edge_cache/bust_user_spec.rb
Alex 494359fd21
Create services for busting organizations, podcast episodes, listings, and users (#11832)
* Create service for bust_organization

* Create bust_podcast_episode_service

* Add error spec to BustOrganization

* Create bust_listings

* Create bust_user service
2020-12-11 08:59:24 -05:00

34 lines
697 B
Ruby

require "rails_helper"
RSpec.describe EdgeCache::BustUser, type: :service do
let(:user) { create(:user) }
let(:paths) do
username = user.username
[
"/#{username}",
"/#{username}?i=i",
"/#{username}/comments",
"/#{username}/comments?i=i",
"/#{username}/comments/?i=i",
"/live/#{username}",
"/live/#{username}?i=i",
"/feed/#{username}",
]
end
before do
paths.each do |path|
allow(described_class).to receive(:bust).with(path).once
end
end
it "busts the cache" do
described_class.call(user)
paths.each do |path|
expect(described_class).to have_received(:bust).with(path).once
end
end
end