@@ -723,9 +723,10 class Project < ActiveRecord::Base | |||||
723 | end |
|
723 | end | |
724 | Redmine::Hook.call_hook(:model_project_copy_before_save, :source_project => project, :destination_project => self) |
|
724 | Redmine::Hook.call_hook(:model_project_copy_before_save, :source_project => project, :destination_project => self) | |
725 | save |
|
725 | save | |
|
726 | else | |||
|
727 | false | |||
726 | end |
|
728 | end | |
727 | end |
|
729 | end | |
728 | true |
|
|||
729 | end |
|
730 | end | |
730 |
|
731 | |||
731 | # Returns a new unsaved Project instance with attributes copied from +project+ |
|
732 | # Returns a new unsaved Project instance with attributes copied from +project+ |
@@ -608,6 +608,13 class ProjectsControllerTest < ActionController::TestCase | |||||
608 | assert_redirected_to :controller => 'projects', :action => 'settings', :id => 'unique-copy' |
|
608 | assert_redirected_to :controller => 'projects', :action => 'settings', :id => 'unique-copy' | |
609 | end |
|
609 | end | |
610 |
|
610 | |||
|
611 | def test_post_copy_with_failure | |||
|
612 | @request.session[:user_id] = 1 | |||
|
613 | post :copy, :id => 1, :project => {:name => 'Copy', :identifier => ''} | |||
|
614 | assert_response :success | |||
|
615 | assert_template 'copy' | |||
|
616 | end | |||
|
617 | ||||
611 | def test_jump_should_redirect_to_active_tab |
|
618 | def test_jump_should_redirect_to_active_tab | |
612 | get :show, :id => 1, :jump => 'issues' |
|
619 | get :show, :id => 1, :jump => 'issues' | |
613 | assert_redirected_to '/projects/ecookbook/issues' |
|
620 | assert_redirected_to '/projects/ecookbook/issues' |
@@ -46,6 +46,11 class ProjectCopyTest < ActiveSupport::TestCase | |||||
46 | @project.enabled_module_names = @source_project.enabled_modules.collect(&:name) |
|
46 | @project.enabled_module_names = @source_project.enabled_modules.collect(&:name) | |
47 | end |
|
47 | end | |
48 |
|
48 | |||
|
49 | def test_copy_should_return_false_if_save_fails | |||
|
50 | project = Project.new(:name => 'Copy', :identifier => nil) | |||
|
51 | assert_equal false, project.copy(@source_project) | |||
|
52 | end | |||
|
53 | ||||
49 | test "#copy should copy issues" do |
|
54 | test "#copy should copy issues" do | |
50 | @source_project.issues << Issue.generate!(:status => IssueStatus.find_by_name('Closed'), |
|
55 | @source_project.issues << Issue.generate!(:status => IssueStatus.find_by_name('Closed'), | |
51 | :subject => "copy issue status", |
|
56 | :subject => "copy issue status", |
General Comments 0
You need to be logged in to leave comments.
Login now