Commit 3e3d6b53 authored by Gabriel Gizotti's avatar Gabriel Gizotti

Change closes issues reference text on MergeRequest#merge_commit_message to...

Change closes issues reference text on MergeRequest#merge_commit_message to match existing text generated by the system
parent f3378630
...@@ -636,8 +636,7 @@ class MergeRequest < ActiveRecord::Base ...@@ -636,8 +636,7 @@ class MergeRequest < ActiveRecord::Base
] ]
if !include_description && closes_issues_references.present? if !include_description && closes_issues_references.present?
issue_text = 'issue'.pluralize(closes_issues_references.size) message << "Closes #{closes_issues_references.to_sentence}"
message << "Closes #{issue_text} #{closes_issues_references.to_sentence}"
end end
message << "#{description}" if include_description && description.present? message << "#{description}" if include_description && description.present?
......
...@@ -20,7 +20,7 @@ feature 'Clicking toggle commit message link', feature: true, js: true do ...@@ -20,7 +20,7 @@ feature 'Clicking toggle commit message link', feature: true, js: true do
[ [
"Merge branch 'feature' into 'master'", "Merge branch 'feature' into 'master'",
merge_request.title, merge_request.title,
"Closes issues #{issue_1.to_reference} and #{issue_2.to_reference}", "Closes #{issue_1.to_reference} and #{issue_2.to_reference}",
"See merge request #{merge_request.to_reference}" "See merge request #{merge_request.to_reference}"
].join("\n\n") ].join("\n\n")
end end
......
...@@ -416,16 +416,16 @@ describe MergeRequest, models: true do ...@@ -416,16 +416,16 @@ describe MergeRequest, models: true do
end end
it 'includes its closed issues in the body' do it 'includes its closed issues in the body' do
issue = create(:issue, project: subject.project) issue = create(:issue, project: subject.project)
subject.project.team << [subject.author, :developer] subject.project.team << [subject.author, :developer]
subject.description = "Closes #{issue.to_reference}" subject.description = "This issue Closes #{issue.to_reference}"
allow(subject.project).to receive(:default_branch). allow(subject.project).to receive(:default_branch).
and_return(subject.target_branch) and_return(subject.target_branch)
expect(subject.merge_commit_message) expect(subject.merge_commit_message)
.to match("Closes issue #{issue.to_reference}") .to match("Closes #{issue.to_reference}")
end end
it 'includes its reference in the body' do it 'includes its reference in the body' do
......
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