diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-10 18:08:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-10 18:08:54 +0300 |
commit | 11e5d1b9ca3efa7be34ddebb708a6aedb4e91639 (patch) | |
tree | 999fdffb9d3db2e5200994e289e50fa3a3a1684a /spec/models/ci | |
parent | 7351a484d79236b7e9d47c86f2fcc970b7ae10b0 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/ci')
-rw-r--r-- | spec/models/ci/job_artifact_spec.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/models/ci/job_artifact_spec.rb b/spec/models/ci/job_artifact_spec.rb index 76e31fddd98..d2fe0d7eeca 100644 --- a/spec/models/ci/job_artifact_spec.rb +++ b/spec/models/ci/job_artifact_spec.rb @@ -111,6 +111,18 @@ describe Ci::JobArtifact do end end + describe '.for_sha' do + it 'returns job artifacts for a given pipeline sha' do + first_pipeline = create(:ci_pipeline) + second_pipeline = create(:ci_pipeline, sha: Digest::SHA1.hexdigest(SecureRandom.hex)) + first_artifact = create(:ci_job_artifact, job: create(:ci_build, pipeline: first_pipeline)) + second_artifact = create(:ci_job_artifact, job: create(:ci_build, pipeline: second_pipeline)) + + expect(described_class.for_sha(first_pipeline.sha)).to eq([first_artifact]) + expect(described_class.for_sha(second_pipeline.sha)).to eq([second_artifact]) + end + end + describe 'callbacks' do subject { create(:ci_job_artifact, :archive) } |