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
return pipeline
end
if pipeline.has_stage_seeds?
unless pipeline.has_stage_seeds?
return error('No stages / jobs for this pipeline.')
end
......
......@@ -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
......
......@@ -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')
......
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