diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 00:09:32 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 00:09:32 +0300 |
commit | ae0889b3960606a480d2d09a57bdab59ddba6195 (patch) | |
tree | 7b2a20fa9bb427b19a0f6377df4bd6c048256ecf /spec/finders | |
parent | 7ea5ca0bb5aa9792c514a22d59217dffa3800581 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/finders')
-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 |