summaryrefslogtreecommitdiff
path: root/spec/serializers
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-18 12:07:48 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-18 12:07:48 +0000
commit79d62647bcfad69d7272020acb7d8be5ee5df003 (patch)
tree008d96a4c5fdfdecda79dae5e942c7df07511c77 /spec/serializers
parent1a9d9cc14ec54036548824e3ce17da03960f5f81 (diff)
downloadgitlab-ce-79d62647bcfad69d7272020acb7d8be5ee5df003.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/serializers')
-rw-r--r--spec/serializers/build_artifact_entity_spec.rb2
-rw-r--r--spec/serializers/build_details_entity_spec.rb22
2 files changed, 24 insertions, 0 deletions
diff --git a/spec/serializers/build_artifact_entity_spec.rb b/spec/serializers/build_artifact_entity_spec.rb
index 09fe094fff1..5f1d5093e0a 100644
--- a/spec/serializers/build_artifact_entity_spec.rb
+++ b/spec/serializers/build_artifact_entity_spec.rb
@@ -4,6 +4,8 @@ require 'spec_helper'
describe BuildArtifactEntity do
let(:job) { create(:ci_build, name: 'test:job', artifacts_expire_at: 1.hour.from_now) }
+ let!(:archive) { create(:ci_job_artifact, :archive, job: job) }
+ let!(:metadata) { create(:ci_job_artifact, :metadata, job: job) }
let(:entity) do
described_class.new(job, request: double)
diff --git a/spec/serializers/build_details_entity_spec.rb b/spec/serializers/build_details_entity_spec.rb
index 91c5fd6bf2c..6fe9eaedfeb 100644
--- a/spec/serializers/build_details_entity_spec.rb
+++ b/spec/serializers/build_details_entity_spec.rb
@@ -176,5 +176,27 @@ describe BuildDetailsEntity do
expect(subject[:reports].first[:file_type]).to eq('codequality')
end
end
+
+ context 'when the build has no archive type artifacts' do
+ let!(:report) { create(:ci_job_artifact, :codequality, job: build) }
+
+ it 'does not expose any artifact actions path' do
+ expect(subject[:artifact].keys).not_to include(:download_path, :browse_path, :keep_path)
+ end
+ end
+
+ context 'when the build has archive type artifacts' do
+ let!(:report) { create(:ci_job_artifact, :codequality, job: build) }
+ let!(:archive) { create(:ci_job_artifact, :archive, job: build) }
+ let!(:metadata) { create(:ci_job_artifact, :metadata, job: build) }
+
+ before do
+ build.update(artifacts_expire_at: 7.days.from_now)
+ end
+
+ it 'exposes artifact details' do
+ expect(subject[:artifact].keys).to include(:download_path, :browse_path, :keep_path, :expire_at, :expired)
+ end
+ end
end
end