summaryrefslogtreecommitdiffstats
path: root/test/unit/project_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-02-15 16:26:48 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-02-15 16:26:48 +0000
commitb05ed594a08611267886942d2f10a52de6b08e44 (patch)
tree0ca8cc96e5096729f245e45c751e8dfb7fad0877 /test/unit/project_test.rb
parent4601ed2f3aebc545024287e318494ce32bc5803f (diff)
downloadredmine-b05ed594a08611267886942d2f10a52de6b08e44.tar.gz
redmine-b05ed594a08611267886942d2f10a52de6b08e44.zip
Do not DELETE/INSERT enabled_modules when updating project modules.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2473 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/project_test.rb')
-rw-r--r--test/unit/project_test.rb17
1 files changed, 16 insertions, 1 deletions
diff --git a/test/unit/project_test.rb b/test/unit/project_test.rb
index 94177f433..27cff13d6 100644
--- a/test/unit/project_test.rb
+++ b/test/unit/project_test.rb
@@ -18,7 +18,9 @@
require File.dirname(__FILE__) + '/../test_helper'
class ProjectTest < Test::Unit::TestCase
- fixtures :projects, :issues, :issue_statuses, :journals, :journal_details, :users, :members, :roles, :projects_trackers, :trackers, :boards
+ fixtures :projects, :enabled_modules,
+ :issues, :issue_statuses, :journals, :journal_details,
+ :users, :members, :roles, :projects_trackers, :trackers, :boards
def setup
@ecookbook = Project.find(1)
@@ -218,4 +220,17 @@ class ProjectTest < Test::Unit::TestCase
Project.delete_all
assert_nil Project.next_identifier
end
+
+ def test_enabled_module_names_should_not_recreate_enabled_modules
+ project = Project.find(1)
+ # Remove one module
+ modules = project.enabled_modules.slice(0..-2)
+ assert modules.any?
+ assert_difference 'EnabledModule.count', -1 do
+ project.enabled_module_names = modules.collect(&:name)
+ end
+ project.reload
+ # Ids should be preserved
+ assert_equal project.enabled_module_ids.sort, modules.collect(&:id).sort
+ end
end