end
Redmine::Hook.call_hook(:model_project_copy_before_save, :source_project => project, :destination_project => self)
save
+ else
+ false
end
end
- true
end
# Returns a new unsaved Project instance with attributes copied from +project+
assert_redirected_to :controller => 'projects', :action => 'settings', :id => 'unique-copy'
end
+ def test_post_copy_with_failure
+ @request.session[:user_id] = 1
+ post :copy, :id => 1, :project => {:name => 'Copy', :identifier => ''}
+ assert_response :success
+ assert_template 'copy'
+ end
+
def test_jump_should_redirect_to_active_tab
get :show, :id => 1, :jump => 'issues'
assert_redirected_to '/projects/ecookbook/issues'
@project.enabled_module_names = @source_project.enabled_modules.collect(&:name)
end
+ def test_copy_should_return_false_if_save_fails
+ project = Project.new(:name => 'Copy', :identifier => nil)
+ assert_equal false, project.copy(@source_project)
+ end
+
test "#copy should copy issues" do
@source_project.issues << Issue.generate!(:status => IssueStatus.find_by_name('Closed'),
:subject => "copy issue status",