diff options
author | Felipe Artur <felipefac@gmail.com> | 2017-02-15 18:01:07 +0300 |
---|---|---|
committer | Felipe Artur <felipefac@gmail.com> | 2017-02-21 23:11:52 +0300 |
commit | 31409030d67858d21281fc72b654246b32f7c6eb (patch) | |
tree | 49f5b2a6e1b89ded26f0cb8db19796b306c30f6e /spec | |
parent | 608711c247c1d58bd8f38e459ea9897b76802dc3 (diff) |
Create compare object with default branch when target branch is missing
Diffstat (limited to 'spec')
-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 |