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
path: root/spec
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2019-01-22 18:36:48 +0300
committerGrzegorz Bizon <grzegorz@gitlab.com>2019-01-22 18:36:48 +0300
commitf02be29e52ceb5622e3182830be833f4dfe7c9ce (patch)
tree7fae317275754e22f656fd71a5ed804aece0b939 /spec
parent7b6fa5ffcbead7c45c331df6d4c7a5352b6c3521 (diff)
parenta2477ec2e363c58857e5f8f08a370282bffa57cf (diff)
Merge branch '55966-when-ref-is-ambiguous-createpipelineservice-raises-an-error' into 'master'
Resolve "When ref is ambiguous, `CreatePipelineService` raises an error" Closes #55966 See merge request gitlab-org/gitlab-ce!24437
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/ci/pipeline/chain/populate_spec.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/pipeline/chain/populate_spec.rb b/spec/lib/gitlab/ci/pipeline/chain/populate_spec.rb
index 1b014ecfaa4..3459939267a 100644
--- a/spec/lib/gitlab/ci/pipeline/chain/populate_spec.rb
+++ b/spec/lib/gitlab/ci/pipeline/chain/populate_spec.rb
@@ -79,6 +79,31 @@ describe Gitlab::Ci::Pipeline::Chain::Populate do
end
end
+ describe 'pipeline protect' do
+ subject { step.perform! }
+
+ context 'when ref is protected' do
+ before do
+ allow(project).to receive(:protected_for?).with('master').and_return(true)
+ allow(project).to receive(:protected_for?).with('refs/heads/master').and_return(true)
+ end
+
+ it 'does not protect the pipeline' do
+ subject
+
+ expect(pipeline.protected).to eq(true)
+ end
+ end
+
+ context 'when ref is not protected' do
+ it 'does not protect the pipeline' do
+ subject
+
+ expect(pipeline.protected).to eq(false)
+ end
+ end
+ end
+
context 'when pipeline has validation errors' do
let(:pipeline) do
build(:ci_pipeline, project: project, ref: nil)