diff options
author | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 13:34:23 -0600 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 13:34:23 -0600 |
commit | 6438df3a1e0fb944485cebf07976160184697d72 (patch) | |
tree | 00b09bfd170e77ae9391b1a2f5a93ef6839f2597 /spec/models/ci/job_artifact_spec.rb | |
parent | 42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff) | |
download | gitlab-ce-6438df3a1e0fb944485cebf07976160184697d72.tar.gz |
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
Diffstat (limited to 'spec/models/ci/job_artifact_spec.rb')
-rw-r--r-- | spec/models/ci/job_artifact_spec.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/models/ci/job_artifact_spec.rb b/spec/models/ci/job_artifact_spec.rb index ef21ca8f100..796947be4c8 100644 --- a/spec/models/ci/job_artifact_spec.rb +++ b/spec/models/ci/job_artifact_spec.rb @@ -219,6 +219,39 @@ RSpec.describe Ci::JobArtifact do end end + describe '.unlocked' do + let_it_be(:job_artifact) { create(:ci_job_artifact) } + + context 'with locked pipelines' do + before do + job_artifact.job.pipeline.artifacts_locked! + end + + it 'returns an empty array' do + expect(described_class.unlocked).to be_empty + end + end + + context 'with unlocked pipelines' do + before do + job_artifact.job.pipeline.unlocked! + end + + it 'returns the artifact' do + expect(described_class.unlocked).to eq([job_artifact]) + end + end + end + + describe '.order_expired_desc' do + let_it_be(:first_artifact) { create(:ci_job_artifact, expire_at: 2.days.ago) } + let_it_be(:second_artifact) { create(:ci_job_artifact, expire_at: 1.day.ago) } + + it 'returns ordered artifacts' do + expect(described_class.order_expired_desc).to eq([second_artifact, first_artifact]) + end + end + describe 'callbacks' do describe '#schedule_background_upload' do subject { create(:ci_job_artifact, :archive) } |