diff options
author | Rémy Coutable <remy@rymai.me> | 2019-09-12 10:23:25 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2019-09-12 10:23:25 +0000 |
commit | 8ace6442171696de9dce9105d6db45fa0da10550 (patch) | |
tree | 0364a41e6dfdc806265536bbac913f8053be199a /spec | |
parent | 5abf3186d408752901621aa4fb7054396128c8ce (diff) | |
parent | 58de7d8f485d34861b077575da29a7cc1ba49bc1 (diff) | |
download | gitlab-ce-8ace6442171696de9dce9105d6db45fa0da10550.tar.gz |
Merge branch '50847-automatically-created-mr-uses-wrong-source-branch-when-branching-from-tag' into 'master'
Resolve "Automatically created MR uses wrong source branch (when branching from Tag)"
Closes #50847
See merge request gitlab-org/gitlab-ce!32392
Diffstat (limited to 'spec')
-rw-r--r-- | spec/services/merge_requests/create_from_issue_service_spec.rb | 16 |
1 files changed, 16 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 0e0da6a13ab..07e0218e1df 100644 --- a/spec/services/merge_requests/create_from_issue_service_spec.rb +++ b/spec/services/merge_requests/create_from_issue_service_spec.rb @@ -112,6 +112,22 @@ describe MergeRequests::CreateFromIssueService do expect(subject[:merge_request].target_branch).to eq('feature') end + context 'when the ref is a tag' do + subject { described_class.new(project, user, ref: 'v1.0.0', **service_params).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 'creates a merge request' do + expect { subject }.to change(target_project.merge_requests, :count).by(1) + end + + it 'sets the merge request target branch to the project default branch' do + expect(subject[:merge_request].target_branch).to eq(target_project.default_branch) + end + end + context 'when ref branch does not exist' do subject { described_class.new(project, user, ref: 'no-such-branch', **service_params).execute } |