diff options
author | Artem Sidorenko <artem@posteo.de> | 2016-09-13 23:05:16 +0200 |
---|---|---|
committer | Artem Sidorenko <artem@posteo.de> | 2016-10-11 10:50:49 +0200 |
commit | 6c1690fcc03406ad3230cb05ba8701289a25ba28 (patch) | |
tree | 0e6b894aaf956f0f48f9954de8a48ff38c107bdc /spec | |
parent | b26a3d538178c82d4e7af2076ba999087225666c (diff) | |
download | gitlab-ce-6c1690fcc03406ad3230cb05ba8701289a25ba28.tar.gz |
Allow empty merge requests
Diffstat (limited to 'spec')
-rw-r--r-- | spec/services/merge_requests/build_service_spec.rb | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/spec/services/merge_requests/build_service_spec.rb b/spec/services/merge_requests/build_service_spec.rb index 0d586e2216b..3a3f07ddcb9 100644 --- a/spec/services/merge_requests/build_service_spec.rb +++ b/spec/services/merge_requests/build_service_spec.rb @@ -52,12 +52,28 @@ describe MergeRequests::BuildService, services: true do end end - context 'no commits in the diff' do - let(:commits) { [] } + context 'same source and target branch' do + let(:source_branch) { 'master' } it 'forbids the merge request from being created' 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 different branches') + end + end + + context 'no commits in the diff' do + let(:commits) { [] } + + it 'allows the merge request to be created' do + expect(merge_request.can_be_created).to eq(true) + end + + it 'adds a WIP prefix to the merge request title' do + expect(merge_request.title).to eq('WIP: Feature branch') + end end context 'one commit in the diff' do |