PUT MergeRequest API endpoint - accept labels as an array
This commit is contained in:
parent
c19c5197e1
commit
ee8cb2d1b3
|
@ -179,8 +179,8 @@ module API
|
|||
optional :description, type: String, desc: 'The description of the merge request'
|
||||
optional :assignee_id, type: Integer, desc: 'The ID of a user to assign the merge request'
|
||||
optional :milestone_id, type: Integer, desc: 'The ID of a milestone to assign the merge request'
|
||||
optional :labels, type: String, desc: 'Comma-separated list of label names'
|
||||
optional :remove_source_branch, type: Boolean, desc: 'Delete source branch when merging'
|
||||
optional :labels, type: String, coerce_with: ->(val) { val.is_a?(Array) ? val.join(', ') : val }, desc: 'Comma-separated list of label names'
|
||||
optional :remove_source_branch, type: Boolean, desc: 'Remove source branch when merging'
|
||||
optional :allow_collaboration, type: Boolean, desc: 'Allow commits from members who can merge to the target branch'
|
||||
optional :allow_maintainer_to_push, type: Boolean, as: :allow_collaboration, desc: '[deprecated] See allow_collaboration'
|
||||
optional :squash, type: Grape::API::Boolean, desc: 'When true, the commits will be squashed into a single commit on merge'
|
||||
|
|
|
@ -1137,6 +1137,19 @@ describe API::MergeRequests do
|
|||
expect(json_response['labels']).to include '&'
|
||||
end
|
||||
|
||||
it 'also accepts labels as an array' do
|
||||
put api("/projects/#{project.id}/merge_requests/#{merge_request.iid}", user),
|
||||
title: 'new issue',
|
||||
labels: ['label', 'label?', 'label&foo', '?', '&']
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(json_response['labels']).to include 'label'
|
||||
expect(json_response['labels']).to include 'label?'
|
||||
expect(json_response['labels']).to include 'label&foo'
|
||||
expect(json_response['labels']).to include '?'
|
||||
expect(json_response['labels']).to include '&'
|
||||
end
|
||||
|
||||
it 'does not update state when title is empty' do
|
||||
put api("/projects/#{project.id}/merge_requests/#{merge_request.iid}", user), params: { state_event: 'close', title: nil }
|
||||
|
||||
|
|
Loading…
Reference in New Issue