Commit f9004813 authored by Jason Goodman's avatar Jason Goodman Committed by Kamil Trzciński

Return bad request from pipelines controller for invalid ci yaml

Change response from ok
parent de84743f
...@@ -60,10 +60,10 @@ class Projects::PipelinesController < Projects::ApplicationController ...@@ -60,10 +60,10 @@ class Projects::PipelinesController < Projects::ApplicationController
.new(project, current_user, create_params) .new(project, current_user, create_params)
.execute(:web, ignore_skip_ci: true, save_on_errors: false) .execute(:web, ignore_skip_ci: true, save_on_errors: false)
if @pipeline.persisted? if @pipeline.created_successfully?
redirect_to project_pipeline_path(project, @pipeline) redirect_to project_pipeline_path(project, @pipeline)
else else
render 'new' render 'new', status: :bad_request
end end
end end
......
...@@ -634,7 +634,8 @@ describe Projects::PipelinesController do ...@@ -634,7 +634,8 @@ describe Projects::PipelinesController do
it 'does not persist a pipeline' do it 'does not persist a pipeline' do
expect { post_request }.not_to change { project.ci_pipelines.count } expect { post_request }.not_to change { project.ci_pipelines.count }
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:bad_request)
expect(response).to render_template('new')
end end
end end
......
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