diff options
author | Grzegorz Bizon <grzegorz@gitlab.com> | 2019-01-22 18:36:48 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2019-01-22 18:36:48 +0300 |
commit | f02be29e52ceb5622e3182830be833f4dfe7c9ce (patch) | |
tree | 7fae317275754e22f656fd71a5ed804aece0b939 /spec | |
parent | 7b6fa5ffcbead7c45c331df6d4c7a5352b6c3521 (diff) | |
parent | a2477ec2e363c58857e5f8f08a370282bffa57cf (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.rb | 25 |
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) |