Commit 4140f6c9 authored by Nick Thomas's avatar Nick Thomas

Merge branch 'merge-request-typo' into 'master'

Return error message for create_merge_request

See merge request gitlab-org/gitlab!28482
parents 671c0c50 a1ddf904
......@@ -186,7 +186,7 @@ class Projects::IssuesController < Projects::ApplicationController
if result[:status] == :success
render json: MergeRequestCreateSerializer.new.represent(result[:merge_request])
else
render json: result[:messsage], status: :unprocessable_entity
render json: result[:message], status: :unprocessable_entity
end
end
......
---
title: Return error message for create_merge_request
merge_request: 28482
author:
type: fixed
......@@ -1249,6 +1249,26 @@ describe Projects::IssuesController do
expect(response).to have_gitlab_http_status(:not_found)
end
context 'invalid branch name' do
it 'is unprocessable' do
post(
:create_merge_request,
params: {
target_project_id: nil,
branch_name: 'master',
ref: 'master',
namespace_id: project.namespace.to_param,
project_id: project.to_param,
id: issue.to_param
},
format: :json
)
expect(response.body).to eq('Branch already exists')
expect(response).to have_gitlab_http_status(:unprocessable_entity)
end
end
context 'target_project_id is set' do
let(:target_project) { fork_project(project, user, repository: true) }
let(:target_project_id) { target_project.id }
......
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