diff options
Diffstat (limited to 'spec/serializers/build_details_entity_spec.rb')
-rw-r--r-- | spec/serializers/build_details_entity_spec.rb | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/spec/serializers/build_details_entity_spec.rb b/spec/serializers/build_details_entity_spec.rb index ef6472e07a0..3166c08ff4e 100644 --- a/spec/serializers/build_details_entity_spec.rb +++ b/spec/serializers/build_details_entity_spec.rb @@ -185,12 +185,38 @@ RSpec.describe BuildDetailsEntity do end end + context 'when the build has expired artifacts' do + let!(:build) { create(:ci_build, :artifacts, artifacts_expire_at: 7.days.ago) } + + it 'does not expose any artifact actions path' do + expect(subject[:artifact].keys).not_to include(:download_path, :browse_path, :keep_path) + end + + it 'artifact locked is false' do + expect(subject.dig(:artifact, :locked)).to eq(false) + end + + context 'when the pipeline is artifacts_locked' do + before do + build.pipeline.update!(locked: :artifacts_locked) + end + + it 'artifact locked is true' do + expect(subject.dig(:artifact, :locked)).to eq(true) + end + + it 'exposes download and browse artifact actions path' do + expect(subject[:artifact].keys).to include(:download_path, :browse_path) + end + end + end + context 'when the build has archive type artifacts' do let!(:build) { create(:ci_build, :artifacts, artifacts_expire_at: 7.days.from_now) } let!(:report) { create(:ci_job_artifact, :codequality, job: build) } it 'exposes artifact details' do - expect(subject[:artifact].keys).to include(:download_path, :browse_path, :keep_path, :expire_at, :expired) + expect(subject[:artifact].keys).to include(:download_path, :browse_path, :keep_path, :expire_at, :expired, :locked) end end end |