Commit bbef8bb5 authored by Izaak Alpert's avatar Izaak Alpert

MR on fork validation error

Wasn't setting fields so validations would fail

Change-Id: I0363c57bf6c8b9937cc1b4140d09071d7c5168c2
parent 216d5e2c
......@@ -70,7 +70,9 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@merge_request.reload_code
redirect_to [@merge_request.target_project, @merge_request], notice: 'Merge request was successfully created.'
else
render "new"
@source_project = @merge_request.source_project
@target_project = @merge_request.target_project
render action: "new"
end
end
......@@ -118,7 +120,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
def update_branches
@target_project = selected_target_project
@target_branches = (@target_project.repository.branch_names).unshift("Select branch")
@target_branches = @target_project.repository.branch_names
@target_branches
end
......
......@@ -80,5 +80,3 @@
target_branch.live("change", function() {
$.get("#{branch_to_project_merge_requests_path(@source_project)}", {target_project_id: target_project.val(),ref: $(this).val() });
});
\ No newline at end of file
});
\ No newline at end of file
......@@ -41,3 +41,10 @@ Feature: Project Forked Merge Requests
Then I see the edit page prefilled for "Merge Request On Forked Project"
@javascript
Scenario: I cannot submit an invalid merge request
Given I visit project "Forked Shop" merge requests page
And I click link "New Merge Request"
And I fill out an invalid "Merge Request On Forked Project" merge request
And I submit the merge request
Then I should see validation errors
\ No newline at end of file
......@@ -152,6 +152,23 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps
end
And 'I fill out an invalid "Merge Request On Forked Project" merge request' do
#If this isn't filled in the rest of the validations won't be triggered
fill_in "merge_request_title", with: "Merge Request On Forked Project"
find(:select, "merge_request_source_project_id", {}).value.should == @forked_project.id.to_s
find(:select, "merge_request_target_project_id", {}).value.should == @forked_project.id.to_s
find(:select, "merge_request_source_branch", {}).value.should == ""
find(:select, "merge_request_target_branch", {}).value.should == ""
end
Then 'I should see validation errors' do
page.should have_content "Source branch can't be blank"
page.should have_content "Target branch can't be blank"
page.should have_content "Branch conflict You can not use same project/branch for source and target"
end
def project
@project ||= Project.find_by_name!("Shop")
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment