Include locale in fragment cache key (#10199)

* Include locale in fragment cache key

* Adjust specs
This commit is contained in:
Ben Halpern 2020-09-09 16:58:04 -04:00 committed by GitHub
parent 141df7ba03
commit 310df39e27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View file

@ -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

View file

@ -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