summaryrefslogtreecommitdiff
path: root/spec/requests/ci/api
diff options
context:
space:
mode:
Diffstat (limited to 'spec/requests/ci/api')
-rw-r--r--spec/requests/ci/api/builds_spec.rb29
1 files changed, 20 insertions, 9 deletions
diff --git a/spec/requests/ci/api/builds_spec.rb b/spec/requests/ci/api/builds_spec.rb
index c077c458163..2ebbe93da3e 100644
--- a/spec/requests/ci/api/builds_spec.rb
+++ b/spec/requests/ci/api/builds_spec.rb
@@ -536,6 +536,7 @@ describe Ci::API::Builds do
let(:headers_with_token) { headers.merge(Ci::API::Helpers::BUILD_TOKEN_HEADER => token) }
before do
+ stub_artifacts_object_storage
build.run!
end
@@ -873,16 +874,26 @@ describe Ci::API::Builds do
end
context 'build has artifacts' do
- let(:build) { create(:ci_build, :artifacts) }
- let(:download_headers) do
- { 'Content-Transfer-Encoding' => 'binary',
- 'Content-Disposition' => 'attachment; filename=ci_build_artifacts.zip' }
- end
-
shared_examples 'having downloadable artifacts' do
- it 'download artifacts' do
- expect(response).to have_http_status(200)
- expect(response.headers).to include download_headers
+ context 'when stored locally' do
+ let(:build) { create(:ci_build, :artifacts) }
+ let(:download_headers) do
+ { 'Content-Transfer-Encoding' => 'binary',
+ 'Content-Disposition' => 'attachment; filename=ci_build_artifacts.zip' }
+ end
+
+ it 'download artifacts' do
+ expect(response).to have_http_status(200)
+ expect(response.headers).to include download_headers
+ end
+ end
+
+ context 'when stored remotely' do
+ let(:build) { create(:ci_build, :artifacts, :remote_store) }
+
+ it 'redirect to artifacts file' do
+ expect(response).to have_http_status(302)
+ end
end
end