Commit e59e48d75a1fba2e0c840acd5bf5125af610297e
Exists in
spb-stable
and in
2 other branches
Merge branch 'fix-500-admin-transfer' into 'master'
Fix 500 error when transfer project from admin area Fixes #1349
Showing
3 changed files
with
34 additions
and
6 deletions
Show diff stats
app/controllers/admin/projects_controller.rb
| @@ -23,13 +23,9 @@ class Admin::ProjectsController < Admin::ApplicationController | @@ -23,13 +23,9 @@ class Admin::ProjectsController < Admin::ApplicationController | ||
| 23 | end | 23 | end |
| 24 | 24 | ||
| 25 | def transfer | 25 | def transfer |
| 26 | - result = ::Projects::TransferService.new(@project, current_user, project: params).execute(:admin) | 26 | + ::Projects::TransferService.new(@project, current_user, params.dup).execute |
| 27 | 27 | ||
| 28 | - if result | ||
| 29 | - redirect_to [:admin, @project] | ||
| 30 | - else | ||
| 31 | - render :show | ||
| 32 | - end | 28 | + redirect_to [:admin, @project.reload] |
| 33 | end | 29 | end |
| 34 | 30 | ||
| 35 | protected | 31 | protected |
features/admin/projects.feature
| @@ -12,3 +12,9 @@ Feature: Admin Projects | @@ -12,3 +12,9 @@ Feature: Admin Projects | ||
| 12 | When I visit admin projects page | 12 | When I visit admin projects page |
| 13 | And I click on first project | 13 | And I click on first project |
| 14 | Then I should see project details | 14 | Then I should see project details |
| 15 | + | ||
| 16 | + Scenario: Transfer project | ||
| 17 | + Given group 'Web' | ||
| 18 | + And I visit admin project page | ||
| 19 | + When I transfer project to group 'Web' | ||
| 20 | + Then I should see project transfered |
features/steps/admin/projects.rb
| @@ -19,4 +19,30 @@ class AdminProjects < Spinach::FeatureSteps | @@ -19,4 +19,30 @@ class AdminProjects < Spinach::FeatureSteps | ||
| 19 | page.should have_content(project.name_with_namespace) | 19 | page.should have_content(project.name_with_namespace) |
| 20 | page.should have_content(project.creator.name) | 20 | page.should have_content(project.creator.name) |
| 21 | end | 21 | end |
| 22 | + | ||
| 23 | + step 'I visit admin project page' do | ||
| 24 | + visit admin_project_path(project) | ||
| 25 | + end | ||
| 26 | + | ||
| 27 | + step 'I transfer project to group \'Web\'' do | ||
| 28 | + find(:xpath, "//input[@id='namespace_id']").set group.id | ||
| 29 | + click_button 'Transfer' | ||
| 30 | + end | ||
| 31 | + | ||
| 32 | + step 'group \'Web\'' do | ||
| 33 | + create(:group, name: 'Web') | ||
| 34 | + end | ||
| 35 | + | ||
| 36 | + step 'I should see project transfered' do | ||
| 37 | + page.should have_content 'Web / ' + project.name | ||
| 38 | + page.should have_content 'Namespace: Web' | ||
| 39 | + end | ||
| 40 | + | ||
| 41 | + def project | ||
| 42 | + @project ||= Project.first | ||
| 43 | + end | ||
| 44 | + | ||
| 45 | + def group | ||
| 46 | + Group.find_by(name: 'Web') | ||
| 47 | + end | ||
| 22 | end | 48 | end |