Include locale in fragment cache key (#10199)
* Include locale in fragment cache key * Adjust specs
This commit is contained in:
parent
141df7ba03
commit
310df39e27
2 changed files with 8 additions and 2 deletions
|
|
@ -184,7 +184,7 @@ module ApplicationHelper
|
|||
release_footprint = ApplicationConfig["RELEASE_FOOTPRINT"]
|
||||
return path if release_footprint.blank?
|
||||
|
||||
"#{path}-#{release_footprint}"
|
||||
"#{path}-#{params[:locale]}-#{release_footprint}"
|
||||
end
|
||||
|
||||
def copyright_notice
|
||||
|
|
|
|||
|
|
@ -43,7 +43,13 @@ RSpec.describe ApplicationHelper, type: :helper do
|
|||
|
||||
it "appends the RELEASE_FOOTPRINT if it is set" do
|
||||
allow(ApplicationConfig).to receive(:[]).with("RELEASE_FOOTPRINT").and_return("abc123")
|
||||
expect(helper.release_adjusted_cache_key("cache-me")).to eq("cache-me-abc123")
|
||||
expect(helper.release_adjusted_cache_key("cache-me")).to eq("cache-me--abc123")
|
||||
end
|
||||
|
||||
it "includes locale param if it is set" do
|
||||
allow(ApplicationConfig).to receive(:[]).with("RELEASE_FOOTPRINT").and_return("abc123")
|
||||
params[:locale] = "fr-ca"
|
||||
expect(helper.release_adjusted_cache_key("cache-me")).to eq("cache-me-fr-ca-abc123")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue