diff options
author | Stan Hu <stanhu@gmail.com> | 2016-06-11 17:16:32 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2016-06-12 05:50:08 +0300 |
commit | a85dde9182f177cc2fdabd90ccdad870bf4d84c3 (patch) | |
tree | b1658e39b1ea6f4807c8e3cd275b39a9eee5f8f6 /spec/requests/api/merge_requests_spec.rb | |
parent | ff345f8ba11658c679b423e06bbc42b90af158eb (diff) |
Fix Error 500 when using closes_issues API with an external issue tracker
Closes #18484
Diffstat (limited to 'spec/requests/api/merge_requests_spec.rb')
-rw-r--r-- | spec/requests/api/merge_requests_spec.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb index 1356f87b0e9..5896b93603f 100644 --- a/spec/requests/api/merge_requests_spec.rb +++ b/spec/requests/api/merge_requests_spec.rb @@ -563,6 +563,21 @@ describe API::API, api: true do expect(json_response).to be_an Array expect(json_response.length).to eq(0) end + + it 'handles external issues' do + jira_project = create(:jira_project, :public, name: 'JIR_EXT1') + issue = ExternalIssue.new("#{jira_project.name}-123", jira_project) + merge_request = create(:merge_request, :simple, author: user, assignee: user, source_project: jira_project) + merge_request.update_attribute(:description, "Closes #{issue.to_reference(jira_project)}") + + get api("/projects/#{jira_project.id}/merge_requests/#{merge_request.id}/closes_issues", user) + + expect(response.status).to eq(200) + expect(json_response).to be_an Array + expect(json_response.length).to eq(1) + expect(json_response.first['title']).to eq(issue.title) + expect(json_response.first['id']).to eq(issue.id) + end end describe 'POST :id/merge_requests/:merge_request_id/subscription' do |