diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /spec/finders/releases | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'spec/finders/releases')
-rw-r--r-- | spec/finders/releases/evidence_pipeline_finder_spec.rb | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/finders/releases/evidence_pipeline_finder_spec.rb b/spec/finders/releases/evidence_pipeline_finder_spec.rb new file mode 100644 index 00000000000..8c435f7b0b6 --- /dev/null +++ b/spec/finders/releases/evidence_pipeline_finder_spec.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Releases::EvidencePipelineFinder, '#execute' do + let(:params) { {} } + let(:project) { create(:project, :repository) } + let(:tag_name) { project.repository.tag_names.first } + let(:sha) { project.repository.find_tag(tag_name).dereferenced_target.sha } + let!(:pipeline) { create(:ci_empty_pipeline, sha: sha, project: project) } + + subject { described_class.new(project, params).execute } + + context 'when the tag is passed' do + let(:params) { { tag: tag_name } } + + it 'returns the evidence pipeline' do + expect(subject).to eq(pipeline) + end + end + + context 'when the ref is passed' do + let(:params) { { ref: sha } } + + it 'returns the evidence pipeline' do + expect(subject).to eq(pipeline) + end + end + + context 'empty params' do + it 'returns nil' do + expect(subject).to be_nil + end + end + + # TODO: remove this with the release creation moved to it's own form https://gitlab.com/gitlab-org/gitlab/-/issues/214245 + context 'params[:evidence_pipeline] is present' do + let(:params) { { evidence_pipeline: pipeline } } + + it 'returns the passed evidence pipeline' do + expect(subject).to eq(pipeline) + end + end +end |