Commit 0a013adc authored by Izaak Alpert's avatar Izaak Alpert

Fix an issue with edits sending user back to @source_project

-Form was for @source_project rather then @project.
-add spinach test for edit submission on forked project

Change-Id: I807a5077608b7e910f4bc83c5d3e82c378f70a9e
parent 532809a1
...@@ -54,10 +54,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -54,10 +54,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end end
def create def create
@merge_request = @project.merge_requests.new(params[:merge_request]) @merge_request = MergeRequest.new(params[:merge_request])
@merge_request.author = current_user @merge_request.author = current_user
@merge_request.source_project_id = params[:merge_request][:source_project_id].to_i
@merge_request.target_project_id = params[:merge_request][:target_project_id].to_i
@target_branches ||= [] @target_branches ||= []
if @merge_request.save if @merge_request.save
@merge_request.reload_code @merge_request.reload_code
......
= form_for [@source_project, @merge_request], html: { class: "#{controller.action_name}-merge-request form-horizontal" } do |f| = form_for [@project, @merge_request], html: { class: "#{controller.action_name}-merge-request form-horizontal" } do |f|
-if @merge_request.errors.any? -if @merge_request.errors.any?
.alert.alert-error .alert.alert-error
%ul %ul
......
...@@ -37,6 +37,9 @@ Feature: Project Forked Merge Requests ...@@ -37,6 +37,9 @@ Feature: Project Forked Merge Requests
And I should see merge request "Merge Request On Forked Project" And I should see merge request "Merge Request On Forked Project"
And I click link edit "Merge Request On Forked Project" And I click link edit "Merge Request On Forked Project"
Then I see the edit page prefilled for "Merge Request On Forked Project" Then I see the edit page prefilled for "Merge Request On Forked Project"
And I update the merge request title
And I save the merge request
Then I should see the edited merge request
@javascript @javascript
Scenario: I cannot submit an invalid merge request Scenario: I cannot submit an invalid merge request
......
...@@ -100,6 +100,28 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps ...@@ -100,6 +100,28 @@ class ProjectForkedMergeRequests < Spinach::FeatureSteps
verify_commit_link(".mr_source_commit",@forked_project) verify_commit_link(".mr_source_commit",@forked_project)
end end
And 'I update the merge request title' do
fill_in "merge_request_title", with: "An Edited Forked Merge Request"
end
And 'I save the merge request' do
click_button "Save changes"
end
Then 'I should see the edited merge request' do
page.should have_content "An Edited Forked Merge Request"
@project.merge_requests.size.should >= 1
@merge_request = @project.merge_requests.last
current_path.should == project_merge_request_path(@project, @merge_request)
@merge_request.source_project.should == @forked_project
@merge_request.source_branch.should == "master"
@merge_request.target_branch.should == "stable"
page.should have_content @forked_project.path_with_namespace
page.should have_content @project.path_with_namespace
page.should have_content @merge_request.source_branch
page.should have_content @merge_request.target_branch
end
Then 'I should see last push widget' do Then 'I should see last push widget' do
page.should have_content "You pushed to new_design" page.should have_content "You pushed to new_design"
page.should have_link "Create Merge Request" page.should have_link "Create Merge Request"
......
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