##// END OF EJS Templates
Fixed: selected modules are not activated when copying a project (#8244)....
Jean-Philippe Lang -
r5461:fab9aca747d8
parent child
Show More
@@ -117,7 +117,6 class ProjectsController < ApplicationController
117 Mailer.with_deliveries(params[:notifications] == '1') do
117 Mailer.with_deliveries(params[:notifications] == '1') do
118 @project = Project.new
118 @project = Project.new
119 @project.safe_attributes = params[:project]
119 @project.safe_attributes = params[:project]
120 @project.enabled_module_names = params[:enabled_modules]
121 if validate_parent_id && @project.copy(@source_project, :only => params[:only])
120 if validate_parent_id && @project.copy(@source_project, :only => params[:only])
122 @project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
121 @project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
123 flash[:notice] = l(:notice_successful_create)
122 flash[:notice] = l(:notice_successful_create)
@@ -448,7 +448,7 class ProjectsControllerTest < ActionController::TestCase
448 end
448 end
449 end
449 end
450
450
451 def test_copy_with_project
451 def test_get_copy
452 @request.session[:user_id] = 1 # admin
452 @request.session[:user_id] = 1 # admin
453 get :copy, :id => 1
453 get :copy, :id => 1
454 assert_response :success
454 assert_response :success
@@ -456,9 +456,12 class ProjectsControllerTest < ActionController::TestCase
456 assert assigns(:project)
456 assert assigns(:project)
457 assert_equal Project.find(1).description, assigns(:project).description
457 assert_equal Project.find(1).description, assigns(:project).description
458 assert_nil assigns(:project).id
458 assert_nil assigns(:project).id
459
460 assert_tag :tag => 'input',
461 :attributes => {:name => 'project[enabled_module_names][]', :value => 'issue_tracking'}
459 end
462 end
460
463
461 def test_copy_without_project
464 def test_get_copy_without_project
462 @request.session[:user_id] = 1 # admin
465 @request.session[:user_id] = 1 # admin
463 get :copy
466 get :copy
464 assert_response :redirect
467 assert_response :redirect
@@ -475,12 +478,14 class ProjectsControllerTest < ActionController::TestCase
475 :name => 'Copy',
478 :name => 'Copy',
476 :identifier => 'unique-copy',
479 :identifier => 'unique-copy',
477 :tracker_ids => ['1', '2', '3', ''],
480 :tracker_ids => ['1', '2', '3', ''],
478 :enabled_modules => %w(issue_tracking time_tracking)
481 :enabled_module_names => %w(issue_tracking time_tracking)
479 },
482 },
480 :only => %w(issues versions)
483 :only => %w(issues versions)
481 end
484 end
482 project = Project.find('unique-copy')
485 project = Project.find('unique-copy')
483 source = Project.find(1)
486 source = Project.find(1)
487 assert_equal %w(issue_tracking time_tracking), project.enabled_module_names.sort
488
484 assert_equal source.versions.count, project.versions.count, "All versions were not copied"
489 assert_equal source.versions.count, project.versions.count, "All versions were not copied"
485 # issues assigned to a closed version won't be copied
490 # issues assigned to a closed version won't be copied
486 assert_equal source.issues.select {|i| i.fixed_version.nil? || i.fixed_version.open?}.size,
491 assert_equal source.issues.select {|i| i.fixed_version.nil? || i.fixed_version.open?}.size,
General Comments 0
You need to be logged in to leave comments. Login now