#472: Update Projects::PullRequestsController

This commit is contained in:
Vokhmin Alexey V 2015-05-22 23:19:07 +03:00
parent 592eed5640
commit 81ddbef53a
3 changed files with 5 additions and 6 deletions

View File

@ -34,7 +34,7 @@ class Projects::PullRequestsController < Projects::BaseController
to_project = find_destination_project
authorize to_project, :show?
@pull = to_project.pull_requests.new pull_params
@pull = to_project.pull_requests.build pull_params
@issue = @pull.issue
@pull.issue.assignee_id = (params[:issue] || {})[:assignee_id] if policy(to_project).write?
@pull.issue.user, @pull.issue.project, @pull.from_project = current_user, to_project, @project
@ -131,7 +131,7 @@ class Projects::PullRequestsController < Projects::BaseController
end
def pull_params
@pull_params ||= params[:pull_request].presence
@pull_params ||= subject_params(PullRequest).presence
end
def json_for_autocomplete_base items

View File

@ -29,10 +29,9 @@ class PullRequestPolicy < ApplicationPolicy
%i(
body
from_ref
issue_attributes
title
to_ref
)
) + [ issue_attributes: %i(title body) ]
end
end

View File

@ -66,7 +66,7 @@ shared_examples_for 'pull request user with project reader rights' do
it "should create pull request to the same project" do
@parent = FactoryGirl.create(:project)
@project.update_attributes({parent_id: @parent}, without_protection: true)
@project.update_attributes(parent_id: @parent)
expect do
post :create, @create_params
@ -77,7 +77,7 @@ shared_examples_for 'pull request user with project reader rights' do
it "should create pull request to the parent project" do
@parent = FactoryGirl.create(:project_with_commit)
@project.update_attributes({parent_id: @parent}, without_protection: true)
@project.update_attributes(parent_id: @parent)
expect do
post :create, @create_params.merge({to_project: @parent.name_with_owner})