diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2018-11-07 18:54:37 +0300 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2018-11-07 23:49:45 +0300 |
commit | 5da2f42dc9609c07fd60d9d1c7a2302353a820c0 (patch) | |
tree | 79d13b23dfdca03f6bcccc4a1ba5c7574df1b145 /spec/controllers/projects | |
parent | 829e452588575c634b2a3dd778e702a6b21465e1 (diff) |
backport: Always proxy reports downloads
This makes to always proxy reports
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 |