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:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-10-22 14:33:28 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-10-22 14:33:28 +0300
commit680afb3d77db2f90b1c79d3917ce5d2df187c68b (patch)
tree7aadac01c9f0b580fa8284b64acb0f688a54a8d9 /spec/models
parent5f412e3a87d1e9444bbef6475a2cd3304f541f7d (diff)
Do not raise error when checking pipeline reference
Return from the `Ci::Pipeline#ref_exists?` in case when there is no repository present. This also fixes pipeline page feature specs by changing pipeline reference instead of stubbing `ref_exist?` method.
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/ci/pipeline_spec.rb34
1 files changed, 23 insertions, 11 deletions
diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb
index 06f000a7118..153244b2159 100644
--- a/spec/models/ci/pipeline_spec.rb
+++ b/spec/models/ci/pipeline_spec.rb
@@ -780,24 +780,36 @@ describe Ci::Pipeline, :mailer do
end
describe 'ref_exists?' do
- using RSpec::Parameterized::TableSyntax
+ context 'when repository exists' do
+ using RSpec::Parameterized::TableSyntax
- let(:project) { create(:project, :repository) }
+ let(:project) { create(:project, :repository) }
- where(:tag, :ref, :result) do
- false | 'master' | true
- false | 'non-existent-branch' | false
- true | 'v1.1.0' | true
- true | 'non-existent-tag' | false
+ where(:tag, :ref, :result) do
+ false | 'master' | true
+ false | 'non-existent-branch' | false
+ true | 'v1.1.0' | true
+ true | 'non-existent-tag' | false
+ end
+
+ with_them do
+ let(:pipeline) do
+ create(:ci_empty_pipeline, project: project, tag: tag, ref: ref)
+ end
+
+ it "correctly detects ref" do
+ expect(pipeline.ref_exists?).to be result
+ end
+ end
end
- with_them do
+ context 'when repository does not exist' do
let(:pipeline) do
- create(:ci_empty_pipeline, project: project, tag: tag, ref: ref)
+ create(:ci_empty_pipeline, project: project, ref: 'master')
end
- it "correctly detects ref" do
- expect(pipeline.ref_exists?).to be result
+ it 'always returns false' do
+ expect(pipeline.ref_exists?).to eq false
end
end
end