diff options
author | Rémy Coutable <remy@rymai.me> | 2016-10-11 12:58:00 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-10-11 12:58:00 +0300 |
commit | 157568f3fd6383a1e3490123664b3f7e4d535976 (patch) | |
tree | 84c79800f3acf6ab8a3dcbda5f17c81c8be61eec /spec/services | |
parent | 0d6bcc5b4bbbfe4144bb71e89e06d16d20ef497d (diff) | |
parent | 6c1690fcc03406ad3230cb05ba8701289a25ba28 (diff) |
Merge branch 'empty-mrs' into 'master'
Allows empty merge requests for a workflow described in gitlab-org/gitlab-ce#14606
Closes gitlab-org/gitlab-ce#14606
See merge request !6384
Diffstat (limited to 'spec/services')
-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 |