summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorAthar Hameed <athar@gitlab.com>2018-06-08 12:28:43 +0000
committerSean McGivern <sean@mcgivern.me.uk>2018-06-08 12:28:43 +0000
commitc22e51e8c1372e844aa3c4447ebea371d77d0c89 (patch)
tree4538509a53d1b1108e953147230fc7fb54553481 /spec
parentf068479e637c52b839c3474a87c2d01e82ba0829 (diff)
downloadgitlab-ce-c22e51e8c1372e844aa3c4447ebea371d77d0c89.tar.gz
Resolve "Automatically created MR uses wrong target branch (when branching from Tag)"
Diffstat (limited to 'spec')
-rw-r--r--spec/services/merge_requests/create_from_issue_service_spec.rb11
1 files changed, 8 insertions, 3 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 38d84cf0ceb..b1882df732d 100644
--- a/spec/services/merge_requests/create_from_issue_service_spec.rb
+++ b/spec/services/merge_requests/create_from_issue_service_spec.rb
@@ -125,9 +125,14 @@ describe MergeRequests::CreateFromIssueService do
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 }
+ subject { described_class.new(project, user, issue_iid: issue.iid, ref: 'no-such-branch').execute }
+
+ it 'creates a merge request' do
+ expect { subject }.to change(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(project.default_branch)
end
end
end