diff options
author | Grzegorz Bizon <grzegorz@gitlab.com> | 2018-11-09 11:46:54 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2018-11-09 11:46:54 +0300 |
commit | ef58a64039c517be7df08eef1b3a7af7ad5eab16 (patch) | |
tree | 7436f4e193a3325b6df027caff5caa2e965db40a /spec/controllers/projects | |
parent | 44d9d72b259bea05fd66d8ae25c9a06aefc93dd1 (diff) | |
parent | 5da2f42dc9609c07fd60d9d1c7a2302353a820c0 (diff) |
Merge branch 'always-proxy-reports' into 'master'
backport: Always proxy reports downloads
See merge request gitlab-org/gitlab-ce!22889
Diffstat (limited to 'spec/controllers/projects')
-rw-r--r-- | spec/controllers/projects/artifacts_controller_spec.rb | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/spec/controllers/projects/artifacts_controller_spec.rb b/spec/controllers/projects/artifacts_controller_spec.rb index 6091185e252..b3c8d6a954e 100644 --- a/spec/controllers/projects/artifacts_controller_spec.rb +++ b/spec/controllers/projects/artifacts_controller_spec.rb @@ -47,14 +47,37 @@ describe Projects::ArtifactsController do context 'when codequality file type is supplied' do let(:file_type) { 'codequality' } - before do - create(:ci_job_artifact, :codequality, job: job) + context 'when file is stored locally' do + before do + create(:ci_job_artifact, :codequality, job: job) + end + + it 'sends the codequality report' do + expect(controller).to receive(:send_file).with(job.job_artifacts_codequality.file.path, hash_including(disposition: 'attachment')).and_call_original + + download_artifact(file_type: file_type) + end end - it 'sends the codequality report' do - expect(controller).to receive(:send_file).with(job.job_artifacts_codequality.file.path, hash_including(disposition: 'attachment')).and_call_original + context 'when file is stored remotely' do + before do + stub_artifacts_object_storage + create(:ci_job_artifact, :remote_store, :codequality, job: job) + end + + it 'sends the codequality report' do + expect(controller).to receive(:redirect_to).and_call_original - download_artifact(file_type: file_type) + download_artifact(file_type: file_type) + end + + context 'when proxied' do + it 'sends the codequality report' do + expect(Gitlab::Workhorse).to receive(:send_url).and_call_original + + download_artifact(file_type: file_type, proxy: true) + end + end end end end |