Bust sidebar when display ad is updated (#12025)
* Bust sidebar when display ad is updated * Fix test
This commit is contained in:
parent
eefec99472
commit
839a30c70e
2 changed files with 12 additions and 0 deletions
|
|
@ -2,6 +2,8 @@ module Admin
|
|||
class DisplayAdsController < Admin::ApplicationController
|
||||
layout "admin"
|
||||
|
||||
after_action :bust_ad_caches, only: %i[create update destroy]
|
||||
|
||||
def index
|
||||
@display_ads = DisplayAd.order(id: :desc)
|
||||
.joins(:organization)
|
||||
|
|
@ -66,5 +68,9 @@ module Admin
|
|||
def authorize_admin
|
||||
authorize DisplayAd, :access?, policy_class: InternalPolicy
|
||||
end
|
||||
|
||||
def bust_ad_caches
|
||||
EdgeCache::BustSidebar.call
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -50,6 +50,12 @@ RSpec.describe "/admin/display_ads", type: :request do
|
|||
post_resource
|
||||
end.to change { DisplayAd.all.count }.by(1)
|
||||
end
|
||||
|
||||
it "busts sidebar" do
|
||||
allow(EdgeCache::BustSidebar).to receive(:call)
|
||||
post_resource
|
||||
expect(EdgeCache::BustSidebar).to have_received(:call).once
|
||||
end
|
||||
end
|
||||
|
||||
describe "PUT /admin/display_ads" do
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue