diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-02 18:08:01 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-02 18:08:01 +0300 |
commit | b375c6c05fbd03aea33a9ee9f82e678bdaa8c3cc (patch) | |
tree | 55f2a32e5fd3d67597fc8c6cc2a01793ee15c87a /spec/lib/gitlab | |
parent | 988b28ec1a379d38f6ac9ed04886ee564fd447fd (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab')
-rw-r--r-- | spec/lib/gitlab/ci/pipeline/chain/build/associations_spec.rb | 62 | ||||
-rw-r--r-- | spec/lib/gitlab/url_builder_spec.rb | 4 |
2 files changed, 64 insertions, 2 deletions
diff --git a/spec/lib/gitlab/ci/pipeline/chain/build/associations_spec.rb b/spec/lib/gitlab/ci/pipeline/chain/build/associations_spec.rb new file mode 100644 index 00000000000..542a2462b59 --- /dev/null +++ b/spec/lib/gitlab/ci/pipeline/chain/build/associations_spec.rb @@ -0,0 +1,62 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe Gitlab::Ci::Pipeline::Chain::Build::Associations do + let(:project) { create(:project, :repository) } + let(:user) { create(:user, developer_projects: [project]) } + let(:pipeline) { Ci::Pipeline.new } + let(:step) { described_class.new(pipeline, command) } + + let(:command) do + Gitlab::Ci::Pipeline::Chain::Command.new( + source: :push, + origin_ref: 'master', + checkout_sha: project.commit.id, + after_sha: nil, + before_sha: nil, + trigger_request: nil, + schedule: nil, + merge_request: nil, + project: project, + current_user: user, + bridge: bridge) + end + + context 'when a bridge is passed in to the pipeline creation' do + let(:bridge) { create(:ci_bridge) } + + it 'links the pipeline to the upstream bridge job' do + step.perform! + + expect(pipeline.source_pipeline).to be_present + expect(pipeline.source_pipeline).to be_valid + expect(pipeline.source_pipeline).to have_attributes( + source_pipeline: bridge.pipeline, source_project: bridge.project, + source_bridge: bridge, project: project + ) + end + + it 'never breaks the chain' do + step.perform! + + expect(step.break?).to eq(false) + end + end + + context 'when a bridge is not passed in to the pipeline creation' do + let(:bridge) { nil } + + it 'leaves the source pipeline empty' do + step.perform! + + expect(pipeline.source_pipeline).to be_nil + end + + it 'never breaks the chain' do + step.perform! + + expect(step.break?).to eq(false) + end + end +end diff --git a/spec/lib/gitlab/url_builder_spec.rb b/spec/lib/gitlab/url_builder_spec.rb index 49011b100ab..11bbf444b1d 100644 --- a/spec/lib/gitlab/url_builder_spec.rb +++ b/spec/lib/gitlab/url_builder_spec.rb @@ -20,7 +20,7 @@ describe Gitlab::UrlBuilder do url = described_class.build(issue) - expect(url).to eq "#{Settings.gitlab['url']}/#{issue.project.full_path}/issues/#{issue.iid}" + expect(url).to eq "#{Settings.gitlab['url']}/#{issue.project.full_path}/-/issues/#{issue.iid}" end end @@ -107,7 +107,7 @@ describe Gitlab::UrlBuilder do url = described_class.build(note) - expect(url).to eq "#{Settings.gitlab['url']}/#{issue.project.full_path}/issues/#{issue.iid}#note_#{note.id}" + expect(url).to eq "#{Settings.gitlab['url']}/#{issue.project.full_path}/-/issues/#{issue.iid}#note_#{note.id}" end end |