diff options
author | Jarka Kadlecová <jarka@gitlab.com> | 2018-01-12 11:39:34 +0300 |
---|---|---|
committer | Jarka Kadlecová <jarka@gitlab.com> | 2018-01-17 09:35:23 +0300 |
commit | 7e9484e9fab052642bc57947ce4610c164da2b9d (patch) | |
tree | 1a16c46bff3f35383ba470d383e65ebc7e92db13 /spec/services/merge_requests | |
parent | 2de8fb7bab49c1a5168ee56fc12e1f3ceb0ad1c7 (diff) |
Set target_branch to the ref branch when creating MR from issue
Diffstat (limited to 'spec/services/merge_requests')
-rw-r--r-- | spec/services/merge_requests/create_from_issue_service_spec.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/services/merge_requests/create_from_issue_service_spec.rb b/spec/services/merge_requests/create_from_issue_service_spec.rb index 623b182b205..75553afc033 100644 --- a/spec/services/merge_requests/create_from_issue_service_spec.rb +++ b/spec/services/merge_requests/create_from_issue_service_spec.rb @@ -112,5 +112,24 @@ describe MergeRequests::CreateFromIssueService do expect(result[:merge_request].assignee).to eq(user) end + + context 'when ref branch is set' do + subject { described_class.new(project, user, issue_iid: issue.iid, ref: 'feature').execute } + + it 'sets the merge request source branch to the new issue branch' do + expect(subject[:merge_request].source_branch).to eq(issue.to_branch_name) + end + + it 'sets the merge request target branch to the ref branch' do + expect(subject[:merge_request].target_branch).to eq('feature') + end + + context 'when ref branch does not exist' do + it 'does not create a merge request' do + expect { described_class.new(project, user, issue_iid: issue.iid, ref: 'nobr').execute } + .not_to change { project.merge_requests.count } + end + end + end end end |