diff options
Diffstat (limited to 'spec/requests/api/merge_requests_spec.rb')
-rw-r--r-- | spec/requests/api/merge_requests_spec.rb | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb index f0ab2f26900..d8fac47d6f6 100644 --- a/spec/requests/api/merge_requests_spec.rb +++ b/spec/requests/api/merge_requests_spec.rb @@ -1150,12 +1150,16 @@ describe API::MergeRequests do describe 'POST /projects/:id/merge_requests/:merge_request_iid/pipelines' do before do - stub_ci_pipeline_yaml_file(YAML.dump({ + stub_ci_pipeline_yaml_file(ci_yaml) + end + + let(:ci_yaml) do + YAML.dump({ rspec: { script: 'ls', only: ['merge_requests'] } - })) + }) end let(:project) do @@ -1208,6 +1212,18 @@ describe API::MergeRequests do expect(response).to have_gitlab_http_status(:not_found) end end + + context 'when the .gitlab-ci.yml file is invalid' do + let(:ci_yaml) { 'invalid yaml file' } + + it 'creates a failed pipeline' do + expect { request }.to change(Ci::Pipeline, :count).by(1) + expect(response).to have_gitlab_http_status(:ok) + expect(json_response).to be_a Hash + expect(merge_request.pipelines_for_merge_request.last).to be_failed + expect(merge_request.pipelines_for_merge_request.last).to be_config_error + end + end end describe 'POST /projects/:id/merge_requests' do |