Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2018-01-11 15:03:33 +0300
committerGrzegorz Bizon <grzegorz@gitlab.com>2018-01-11 15:03:33 +0300
commite726644123c70eb8f62a6b6b433c2e4fea8e8a52 (patch)
tree392f17657120ce1374be731edf4a139aa6d0b8d5 /spec
parente51e97ede30ed0e3724ef185052e0ef549d5b1d1 (diff)
parentf9cf2f99763129c4cab4ccd24b4d53886fbc8a92 (diff)
Merge branch 'Ben305/gitlab-ce-36669-default-mr-title-with-external-issues' into 'master'
Resolve "Incorrect default merge request title when Jira activated" Closes #36669 See merge request gitlab-org/gitlab-ce!16356
Diffstat (limited to 'spec')
-rw-r--r--spec/services/merge_requests/build_service_spec.rb26
1 files changed, 24 insertions, 2 deletions
diff --git a/spec/services/merge_requests/build_service_spec.rb b/spec/services/merge_requests/build_service_spec.rb
index a9605c6e4c6..cb4c3e72aa0 100644
--- a/spec/services/merge_requests/build_service_spec.rb
+++ b/spec/services/merge_requests/build_service_spec.rb
@@ -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
@@ -241,8 +259,12 @@ describe MergeRequests::BuildService do
allow(project).to receive(:external_issue_tracker).and_return(true)
end
- it 'sets the title to: Resolves External Issue $issue-iid' do
- expect(merge_request.title).to eq('Resolve External Issue 12345')
+ 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