Commit 34a92b48 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Remove duplicate reference to issue

When generating the default MR description, the "Closes #xxx" /
"Related to #xxx" text is duplicated when there is a configured MR
template.

This fixes the bug where `append_closes_description` is called twice
parent deb72ebb
...@@ -16,8 +16,6 @@ module EE ...@@ -16,8 +16,6 @@ module EE
merge_request.description.blank? merge_request.description.blank?
merge_request.description = target_project.merge_requests_template merge_request.description = target_project.merge_requests_template
append_closes_description
end end
end end
end end
......
...@@ -66,6 +66,31 @@ RSpec.describe MergeRequests::BuildService do ...@@ -66,6 +66,31 @@ RSpec.describe MergeRequests::BuildService do
expect(merge_request.description).to eq(description) expect(merge_request.description).to eq(description)
end end
end end
context 'when MR is set to close an issue' do
let(:issue) { create(:issue, project: project) }
let(:service) do
described_class.new(
project,
user,
description: description,
source_branch: source_branch,
target_branch: target_branch,
source_project: source_project,
target_project: target_project,
issue_iid: issue.iid
)
end
before do
project.add_guest(user)
end
it 'appends closing reference once' do
expect(merge_request.description).to eq(template + "\n\nCloses ##{issue.iid}")
end
end
end end
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