diff options
-rw-r--r-- | app/models/role.rb | 1 | ||||
-rw-r--r-- | test/functional/roles_controller_test.rb | 2 | ||||
-rw-r--r-- | test/unit/role_test.rb | 7 |
3 files changed, 9 insertions, 1 deletions
diff --git a/app/models/role.rb b/app/models/role.rb index c77412e88..8b4dbde86 100644 --- a/app/models/role.rb +++ b/app/models/role.rb @@ -109,6 +109,7 @@ class Role < ActiveRecord::Base role = arg.is_a?(Role) ? arg : Role.find_by_id(arg.to_s) self.attributes = role.attributes.dup.except("id", "name", "position", "builtin", "permissions") self.permissions = role.permissions.dup + self.managed_role_ids = role.managed_role_ids.dup self end diff --git a/test/functional/roles_controller_test.rb b/test/functional/roles_controller_test.rb index 88bb46826..c6f19b87b 100644 --- a/test/functional/roles_controller_test.rb +++ b/test/functional/roles_controller_test.rb @@ -129,7 +129,7 @@ class RolesControllerTest < Redmine::ControllerTest assert_response 302 end assert_equal false, role.all_roles_managed - assert_equal [2, 3], role.managed_role_ids + assert_equal [2, 3], role.managed_role_ids.sort end def test_edit diff --git a/test/unit/role_test.rb b/test/unit/role_test.rb index a04398255..092df322e 100644 --- a/test/unit/role_test.rb +++ b/test/unit/role_test.rb @@ -45,6 +45,13 @@ class RoleTest < ActiveSupport::TestCase assert copy.save end + def test_copy_from_should_copy_managed_roles + orig = Role.generate!(:all_roles_managed => false, :managed_role_ids => [2, 3]) + role = Role.new + role.copy_from orig + assert_equal [2, 3], role.managed_role_ids.sort + end + def test_copy_workflows source = Role.find(1) rule_count = source.workflow_rules.count |