From 31409030d67858d21281fc72b654246b32f7c6eb Mon Sep 17 00:00:00 2001 From: Felipe Artur Date: Wed, 15 Feb 2017 13:01:07 -0200 Subject: Create compare object with default branch when target branch is missing --- spec/services/merge_requests/build_service_spec.rb | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'spec/services') 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 -- cgit v1.2.1