diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-08-18 06:46:49 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-08-18 06:46:49 +0000 |
commit | b5af1cb23514e905ba26f74944df709c97e96b3e (patch) | |
tree | a598ec964289cd6fa0effd53f3e5b13b27587b05 /test/unit/project_test.rb | |
parent | a6c0e0e886cb70cd7db3fc50cbf42359eb18eff6 (diff) | |
download | redmine-b5af1cb23514e905ba26f74944df709c97e96b3e.tar.gz redmine-b5af1cb23514e905ba26f74944df709c97e96b3e.zip |
Project.copy_from deletes enabled_modules on source (#20512).
Fix by Ondřej Ezr.
git-svn-id: http://svn.redmine.org/redmine/trunk@14508 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/project_test.rb')
-rw-r--r-- | test/unit/project_test.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/test/unit/project_test.rb b/test/unit/project_test.rb index 4d6979fe6..c76272e7b 100644 --- a/test/unit/project_test.rb +++ b/test/unit/project_test.rb @@ -723,13 +723,26 @@ class ProjectTest < ActiveSupport::TestCase # Duplicated attributes assert_equal source_project.description, copied_project.description - assert_equal source_project.enabled_modules, copied_project.enabled_modules assert_equal source_project.trackers, copied_project.trackers # Default attributes assert_equal 1, copied_project.status end + def test_copy_from_should_copy_enabled_modules + source = Project.generate! + source.enabled_module_names = %w(issue_tracking wiki) + + copy = Project.copy_from(source) + copy.name = 'Copy' + copy.identifier = 'copy' + assert_difference 'EnabledModule.count', 2 do + copy.save! + end + assert_equal 2, copy.reload.enabled_modules.count + assert_equal 2, source.reload.enabled_modules.count + end + def test_activities_should_use_the_system_activities project = Project.find(1) assert_equal project.activities.to_a, TimeEntryActivity.where(:active => true).to_a |