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')