Fix project trasnfer for admin area

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
Dmitriy Zaporozhets 2014-06-19 13:20:42 +03:00
parent 67934145e8
commit f3369e3a00
No known key found for this signature in database
GPG key ID: 627C5F589F467F17
3 changed files with 34 additions and 6 deletions

View file

@ -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

View file

@ -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

View file

@ -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