Merge branch '28890-allow-creating-mr-without-target-branch-in-url' into 'master'

Allow creating merge request even if target branch is not specified in query params

Closes #28890

See merge request !9968
This commit is contained in:
Sean McGivern 2017-03-20 11:20:55 +00:00
commit 9bfff603fe
4 changed files with 10 additions and 3 deletions

View file

@ -6,7 +6,7 @@ module MergeRequests
merge_request.source_project = find_source_project
merge_request.target_project = find_target_project
merge_request.target_branch = find_target_branch
merge_request.can_be_created = branches_valid? && source_branch_specified? && target_branch_specified?
merge_request.can_be_created = branches_valid?
compare_branches if branches_present?
assign_title_and_description if merge_request.can_be_created

View file

@ -0,0 +1,5 @@
---
title: Allow creating merge request even if target branch is not specified in query
params
merge_request: 9968
author:

View file

@ -133,7 +133,6 @@ feature 'Merge Requests > User uses slash commands', feature: true, js: true do
it 'changes target_branch in new merge_request' do
visit new_namespace_project_merge_request_path(another_project.namespace, another_project, new_url_opts)
click_button "Compare branches and continue"
fill_in "merge_request_title", with: 'My brand new feature'
fill_in "merge_request_description", with: "le feature \n/target_branch fix\nFeature description:"

View file

@ -49,10 +49,13 @@ describe MergeRequests::BuildService, services: true do
let(:commits) { Commit.decorate([commit_1], project) }
it 'creates compare object with target branch as default branch' do
expect(merge_request.can_be_created).to eq(false)
expect(merge_request.compare).to be_present
expect(merge_request.target_branch).to eq(project.default_branch)
end
it 'allows the merge request to be created' do
expect(merge_request.can_be_created).to eq(true)
end
end
context 'same source and target branch' do