diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 11:27:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 11:27:35 +0300 |
commit | 7e9c479f7de77702622631cff2628a9c8dcbc627 (patch) | |
tree | c8f718a08e110ad7e1894510980d2155a6549197 /spec/controllers/projects/raw_controller_spec.rb | |
parent | e852b0ae16db4052c1c567d9efa4facc81146e88 (diff) |
Add latest changes from gitlab-org/gitlab@13-6-stable-eev13.6.0-rc42
Diffstat (limited to 'spec/controllers/projects/raw_controller_spec.rb')
-rw-r--r-- | spec/controllers/projects/raw_controller_spec.rb | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/spec/controllers/projects/raw_controller_spec.rb b/spec/controllers/projects/raw_controller_spec.rb index b3921164c81..43cf1a16051 100644 --- a/spec/controllers/projects/raw_controller_spec.rb +++ b/spec/controllers/projects/raw_controller_spec.rb @@ -33,11 +33,6 @@ RSpec.describe Projects::RawController do it_behaves_like 'project cache control headers' it_behaves_like 'content disposition headers' - it_behaves_like 'uncached response' do - before do - subject - end - end end context 'image header' do @@ -225,6 +220,32 @@ RSpec.describe Projects::RawController do end end end + + describe 'caching' do + def request_file + get(:show, params: { namespace_id: project.namespace, project_id: project, id: 'master/README.md' }) + end + + it 'sets appropriate caching headers' do + sign_in create(:user) + request_file + + expect(response.cache_control[:public]).to eq(true) + expect(response.cache_control[:max_age]).to eq(60) + expect(response.cache_control[:no_store]).to be_nil + end + + context 'when If-None-Match header is set' do + it 'returns a 304 status' do + request_file + + request.headers['If-None-Match'] = response.headers['ETag'] + request_file + + expect(response).to have_gitlab_http_status(:not_modified) + end + end + end end def execute_raw_requests(requests:, project:, file_path:, **params) |