diff options
Diffstat (limited to 'spec/controllers/projects/artifacts_controller_spec.rb')
-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 |