summaryrefslogtreecommitdiff
path: root/spec/controllers/application_controller_spec.rb
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2018-10-18 13:28:12 +0200
committerJames Lopez <james@jameslopez.es>2018-10-23 16:22:12 +0200
commit782badd0a2cd00d2a9cbe591e78b30aca32e252b (patch)
treee5b15926abfa825f0807b98547bcfe1609b67a33 /spec/controllers/application_controller_spec.rb
parent329aa24920d9bf385c244e648db4ab38dd3c23e8 (diff)
downloadgitlab-ce-782badd0a2cd00d2a9cbe591e78b30aca32e252b.tar.gz
Fix content caching for non auth users
Diffstat (limited to 'spec/controllers/application_controller_spec.rb')
-rw-r--r--spec/controllers/application_controller_spec.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb
index be3fc832008..4e91068ab88 100644
--- a/spec/controllers/application_controller_spec.rb
+++ b/spec/controllers/application_controller_spec.rb
@@ -792,4 +792,30 @@ describe ApplicationController do
end
end
end
+
+ context 'control headers' do
+ controller(described_class) do
+ def index
+ render json: :ok
+ end
+ end
+
+ context 'user not logged in' do
+ it 'sets the default headers' do
+ get :index
+
+ expect(response.headers['Cache-Control']).to be_nil
+ end
+ end
+
+ context 'user logged in' do
+ it 'sets the default headers' do
+ sign_in(user)
+
+ get :index
+
+ expect(response.headers['Cache-Control']).to eq 'max-age=0, private, must-revalidate, no-store'
+ end
+ end
+ end
end