FIX: cache admin locale file for 24 hours

This commit is contained in:
Sam
2018-01-09 10:23:49 +11:00
parent fb863e18ec
commit 8ff5f5f2ef
5 changed files with 40 additions and 6 deletions

View File

@@ -4,6 +4,16 @@ describe ExtraLocalesController do
context 'show' do
it "caches for 24 hours if version is provided and it matches current hash" do
get :show, params: { bundle: 'admin', v: ExtraLocalesController.bundle_js_hash('admin') }
expect(response.headers["Cache-Control"]).to eq("max-age=86400, public, immutable")
end
it "does not cache at all if version is invalid" do
get :show, params: { bundle: 'admin', v: 'a' * 32 }
expect(response.headers["Cache-Control"]).not_to eq("max-age=86400, public, immutable")
end
it "needs a valid bundle" do
get :show, params: { bundle: 'made-up-bundle' }
expect(response).to_not be_success