diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-02-22 10:13:33 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-02-22 10:13:33 +0000 |
commit | 7bf28a4adaabac7b974ef7d829e604d77eb9d9df (patch) | |
tree | f0d7abf8571a9c382b2ea8f735e3b8fc35c6becf /spec/services | |
parent | 7e8a6a63af2138c5f3f2030ef8c65e8d4815eed3 (diff) | |
parent | 31409030d67858d21281fc72b654246b32f7c6eb (diff) | |
download | gitlab-ce-7bf28a4adaabac7b974ef7d829e604d77eb9d9df.tar.gz |
Merge branch 'issue_28051_2' into 'master'
Create compare object with default branch when target branch is missing
Closes #28051
See merge request !9263
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/merge_requests/build_service_spec.rb | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/spec/services/merge_requests/build_service_spec.rb b/spec/services/merge_requests/build_service_spec.rb index dc945ca4868..0768f644036 100644 --- a/spec/services/merge_requests/build_service_spec.rb +++ b/spec/services/merge_requests/build_service_spec.rb @@ -44,15 +44,14 @@ describe MergeRequests::BuildService, services: true do end end - context 'missing target branch' do - let(:target_branch) { '' } + context 'when target branch is missing' do + let(:target_branch) { nil } + let(:commits) { Commit.decorate([commit_1], project) } - it 'forbids the merge request from being created' do + it 'creates compare object with target branch as default branch' do expect(merge_request.can_be_created).to eq(false) - end - - it 'adds an error message to the merge request' do - expect(merge_request.errors).to contain_exactly('You must select source and target branch') + expect(merge_request.compare).to be_present + expect(merge_request.target_branch).to eq(project.default_branch) end end |