Skip to content
Snippets Groups Projects
Commit ca275561 authored by Sean McGivern's avatar Sean McGivern
Browse files

Never set special MR titles for external issues

parent 44c8f919
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -154,13 +154,9 @@ module MergeRequests
end
 
def assign_title_from_issue
return unless issue
return unless issue && issue.is_a?(Issue)
 
merge_request.title =
case issue
when Issue then "Resolve \"#{issue.title}\""
when ExternalIssue then merge_request.source_branch.titleize.humanize
end
merge_request.title = "Resolve \"#{issue.title}\""
end
 
def issue_iid
Loading
Loading
Loading
Loading
@@ -171,6 +171,24 @@ describe MergeRequests::BuildService do
end
end
end
context 'branch starts with external issue IID followed by a hyphen' do
let(:source_branch) { '12345-fix-issue' }
before do
allow(project).to receive(:external_issue_tracker).and_return(true)
end
it 'uses the title of the commit as the title of the merge request' do
expect(merge_request.title).to eq(commit_1.safe_message.split("\n").first)
end
it 'uses the description of the commit as the description of the merge request and appends the closes text' do
commit_description = commit_1.safe_message.split(/\n+/, 2).last
expect(merge_request.description).to eq("#{commit_description}\n\nCloses #12345")
end
end
end
 
context 'more than one commit in the diff' do
Loading
Loading
@@ -244,6 +262,10 @@ describe MergeRequests::BuildService do
it 'sets the title to the humanized branch title' do
expect(merge_request.title).to eq('12345 fix issue')
end
it 'appends the closes text' do
expect(merge_request.description).to eq('Closes #12345')
end
end
end
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment