Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-27 15:08:35 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-27 15:08:35 +0300
commit22e9af3c8b8aedf7f46b786be968862b74a2d07e (patch)
treea10a7d9af40a17fe6cda7b3a681f5e5e2112c16e /spec/services
parentc8e28a0bb8dd45d91cb72ff2c930bc4a562f1fc7 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/ci/create_pipeline_service/pre_post_stages_spec.rb60
-rw-r--r--spec/services/system_notes/merge_requests_service_spec.rb2
2 files changed, 61 insertions, 1 deletions
diff --git a/spec/services/ci/create_pipeline_service/pre_post_stages_spec.rb b/spec/services/ci/create_pipeline_service/pre_post_stages_spec.rb
new file mode 100644
index 00000000000..db9b89f090f
--- /dev/null
+++ b/spec/services/ci/create_pipeline_service/pre_post_stages_spec.rb
@@ -0,0 +1,60 @@
+# frozen_string_literal: true
+require 'spec_helper'
+
+describe Ci::CreatePipelineService do
+ context '.pre/.post stages' do
+ let_it_be(:user) { create(:admin) }
+ let_it_be(:project) { create(:project, :repository, creator: user) }
+
+ let(:source) { :push }
+ let(:service) { described_class.new(project, user, { ref: ref }) }
+ let(:pipeline) { service.execute(source) }
+
+ let(:config) do
+ <<~YAML
+ validate:
+ stage: .pre
+ script: echo Hello World
+
+ build:
+ stage: build
+ rules:
+ - if: $CI_COMMIT_BRANCH == "master"
+ script: echo Hello World
+
+ notify:
+ stage: .post
+ script: echo Hello World
+ YAML
+ end
+
+ before do
+ stub_ci_pipeline_yaml_file(config)
+ end
+
+ context 'when pipeline contains a build except .pre/.post' do
+ let(:ref) { 'refs/heads/master' }
+
+ it 'creates a pipeline' do
+ expect(pipeline).to be_persisted
+ expect(pipeline.stages.map(&:name)).to contain_exactly(
+ *%w(.pre build .post))
+ expect(pipeline.builds.map(&:name)).to contain_exactly(
+ *%w(validate build notify))
+ end
+ end
+
+ context 'when pipeline does not contain any other build except .pre/.post' do
+ let(:ref) { 'refs/heads/feature' }
+
+ it 'does not create a pipeline' do
+ expect(pipeline).not_to be_persisted
+
+ # we can validate a list of stages, as they are assigned
+ # but not persisted
+ expect(pipeline.stages.map(&:name)).to contain_exactly(
+ *%w(.pre .post))
+ end
+ end
+ end
+end
diff --git a/spec/services/system_notes/merge_requests_service_spec.rb b/spec/services/system_notes/merge_requests_service_spec.rb
index 2a04e888ae0..f5c071502f5 100644
--- a/spec/services/system_notes/merge_requests_service_spec.rb
+++ b/spec/services/system_notes/merge_requests_service_spec.rb
@@ -253,7 +253,7 @@ describe ::SystemNotes::MergeRequestsService do
end
it "posts the 'picked merge request' system note" do
- expect(subject.note).to eq("picked this merge request into branch [`#{branch_name}`](/#{project.full_path}/tree/#{branch_name}) with commit #{commit_sha}")
+ expect(subject.note).to eq("picked this merge request into branch [`#{branch_name}`](/#{project.full_path}/-/tree/#{branch_name}) with commit #{commit_sha}")
end
it 'links the merge request and the cherry-pick commit' do