Commit 626cb8ed authored by Grzegorz Bizon's avatar Grzegorz Bizon

Fix invalid conditional in pipeline create service

parent fe0b2f81
...@@ -42,7 +42,7 @@ module Ci ...@@ -42,7 +42,7 @@ module Ci
return pipeline return pipeline
end end
if pipeline.has_stage_seeds? unless pipeline.has_stage_seeds?
return error('No stages / jobs for this pipeline.') return error('No stages / jobs for this pipeline.')
end end
......
...@@ -21,10 +21,9 @@ describe Gitlab::Ci::Stage::Seed do ...@@ -21,10 +21,9 @@ describe Gitlab::Ci::Stage::Seed do
describe '#builds' do describe '#builds' do
it 'returns hash attributes of all builds' do it 'returns hash attributes of all builds' do
expect(subject.builds.size).to eq 2 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(ref: 'master'))
expect(subject.builds).to all(include(tag: false)) expect(subject.builds).to all(include(tag: false))
expect(subject.builds).to all(include(project: pipeline.project))
expect(subject.builds) expect(subject.builds)
.to all(include(trigger_request: pipeline.trigger_requests.first)) .to all(include(trigger_request: pipeline.trigger_requests.first))
end end
......
...@@ -9,10 +9,10 @@ describe Ci::CreatePipelineService, :services do ...@@ -9,10 +9,10 @@ describe Ci::CreatePipelineService, :services do
end end
describe '#execute' do 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, params = { ref: ref,
before: '00000000', before: '00000000',
after: after, after: after_sha,
commits: [{ message: message }] } commits: [{ message: message }] }
described_class.new(project, user, params).execute described_class.new(project, user, params).execute
...@@ -30,6 +30,7 @@ describe Ci::CreatePipelineService, :services do ...@@ -30,6 +30,7 @@ describe Ci::CreatePipelineService, :services do
it 'creates a pipeline' do it 'creates a pipeline' do
expect(pipeline).to be_kind_of(Ci::Pipeline) expect(pipeline).to be_kind_of(Ci::Pipeline)
expect(pipeline).to be_valid expect(pipeline).to be_valid
expect(pipeline).to be_persisted
expect(pipeline).to eq(project.pipelines.last) expect(pipeline).to eq(project.pipelines.last)
expect(pipeline).to have_attributes(user: user) expect(pipeline).to have_attributes(user: user)
expect(pipeline).to have_attributes(status: 'pending') expect(pipeline).to have_attributes(status: 'pending')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment