Commit e59e48d7 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'fix-500-admin-transfer' into 'master'

Fix 500 error when transfer project from admin area

Fixes #1349
parents b6435147 f3369e3a
......@@ -23,13 +23,9 @@ class Admin::ProjectsController < Admin::ApplicationController
end
def transfer
result = ::Projects::TransferService.new(@project, current_user, project: params).execute(:admin)
::Projects::TransferService.new(@project, current_user, params.dup).execute
if result
redirect_to [:admin, @project]
else
render :show
end
redirect_to [:admin, @project.reload]
end
protected
......
......@@ -12,3 +12,9 @@ Feature: Admin Projects
When I visit admin projects page
And I click on first project
Then I should see project details
Scenario: Transfer project
Given group 'Web'
And I visit admin project page
When I transfer project to group 'Web'
Then I should see project transfered
......@@ -19,4 +19,30 @@ class AdminProjects < Spinach::FeatureSteps
page.should have_content(project.name_with_namespace)
page.should have_content(project.creator.name)
end
step 'I visit admin project page' do
visit admin_project_path(project)
end
step 'I transfer project to group \'Web\'' do
find(:xpath, "//input[@id='namespace_id']").set group.id
click_button 'Transfer'
end
step 'group \'Web\'' do
create(:group, name: 'Web')
end
step 'I should see project transfered' do
page.should have_content 'Web / ' + project.name
page.should have_content 'Namespace: Web'
end
def project
@project ||= Project.first
end
def group
Group.find_by(name: 'Web')
end
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