diff options
author | 🙈 jacopo beschi 🙉 <intrip@gmail.com> | 2019-09-12 13:23:24 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2019-09-12 13:23:24 +0300 |
commit | 58de7d8f485d34861b077575da29a7cc1ba49bc1 (patch) | |
tree | 0364a41e6dfdc806265536bbac913f8053be199a /spec/services/merge_requests/create_from_issue_service_spec.rb | |
parent | 5abf3186d408752901621aa4fb7054396128c8ce (diff) |
Fix create MR from issue using a tag as ref
Creating a MR from an issue using a tag as ref correctly creates the
source branch starting from the tag.
Diffstat (limited to 'spec/services/merge_requests/create_from_issue_service_spec.rb')
-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 } |