summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-06-02 15:05:14 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-06-02 15:05:14 +0200
commit626cb8edc3f4421fe7e866c51fddc2715875ddda (patch)
tree9f2430c172dfdc64bf60829259c32b9a834c462c
parentfe0b2f81c7c9680a11288e0cdffc3e80dc1e8d58 (diff)
downloadgitlab-ce-626cb8edc3f4421fe7e866c51fddc2715875ddda.tar.gz
Fix invalid conditional in pipeline create service
-rw-r--r--app/services/ci/create_pipeline_service.rb2
-rw-r--r--spec/lib/gitlab/ci/stage/seed_spec.rb3
-rw-r--r--spec/services/ci/create_pipeline_service_spec.rb5
3 files changed, 5 insertions, 5 deletions
diff --git a/app/services/ci/create_pipeline_service.rb b/app/services/ci/create_pipeline_service.rb
index 4dd74ebb1bb..5ff388c6614 100644
--- a/app/services/ci/create_pipeline_service.rb
+++ b/app/services/ci/create_pipeline_service.rb
@@ -42,7 +42,7 @@ module Ci
return pipeline
end
- if pipeline.has_stage_seeds?
+ unless pipeline.has_stage_seeds?
return error('No stages / jobs for this pipeline.')
end
diff --git a/spec/lib/gitlab/ci/stage/seed_spec.rb b/spec/lib/gitlab/ci/stage/seed_spec.rb
index 15bcce04447..f4353040ce6 100644
--- a/spec/lib/gitlab/ci/stage/seed_spec.rb
+++ b/spec/lib/gitlab/ci/stage/seed_spec.rb
@@ -21,10 +21,9 @@ describe Gitlab::Ci::Stage::Seed do
describe '#builds' do
it 'returns hash attributes of all builds' do
expect(subject.builds.size).to eq 2
- expect(subject.builds).to all(include(pipeline: pipeline))
- expect(subject.builds).to all(include(project: pipeline.project))
expect(subject.builds).to all(include(ref: 'master'))
expect(subject.builds).to all(include(tag: false))
+ expect(subject.builds).to all(include(project: pipeline.project))
expect(subject.builds)
.to all(include(trigger_request: pipeline.trigger_requests.first))
end
diff --git a/spec/services/ci/create_pipeline_service_spec.rb b/spec/services/ci/create_pipeline_service_spec.rb
index 674de2d80c1..fe5de2ce227 100644
--- a/spec/services/ci/create_pipeline_service_spec.rb
+++ b/spec/services/ci/create_pipeline_service_spec.rb
@@ -9,10 +9,10 @@ describe Ci::CreatePipelineService, :services do
end
describe '#execute' do
- def execute_service(after: project.commit.id, message: 'Message', ref: 'refs/heads/master')
+ def execute_service(after_sha: project.commit.id, message: 'Message', ref: 'refs/heads/master')
params = { ref: ref,
before: '00000000',
- after: after,
+ after: after_sha,
commits: [{ message: message }] }
described_class.new(project, user, params).execute
@@ -30,6 +30,7 @@ describe Ci::CreatePipelineService, :services do
it 'creates a pipeline' do
expect(pipeline).to be_kind_of(Ci::Pipeline)
expect(pipeline).to be_valid
+ expect(pipeline).to be_persisted
expect(pipeline).to eq(project.pipelines.last)
expect(pipeline).to have_attributes(user: user)
expect(pipeline).to have_attributes(status: 'pending')