diff options
Diffstat (limited to 'spec/serializers/build_details_entity_spec.rb')
-rw-r--r-- | spec/serializers/build_details_entity_spec.rb | 22 |
1 files changed, 22 insertions, 0 deletions
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 |