summaryrefslogtreecommitdiffstats
path: root/test/unit/role_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-09-03 17:04:28 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-09-03 17:04:28 +0000
commitca7498c2d6cc31176690b597dba10f7c853a8b57 (patch)
treebe7b1c5e21e0b72b064373cda73557ef4f8ab8ba /test/unit/role_test.rb
parent1b64e4be5ea81389da7f10c5e76dfb3a504688a7 (diff)
downloadredmine-ca7498c2d6cc31176690b597dba10f7c853a8b57.tar.gz
redmine-ca7498c2d6cc31176690b597dba10f7c853a8b57.zip
Create role by copy (#9258).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10285 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/role_test.rb')
-rw-r--r--test/unit/role_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/unit/role_test.rb b/test/unit/role_test.rb
index e61280fc9..e93d76c84 100644
--- a/test/unit/role_test.rb
+++ b/test/unit/role_test.rb
@@ -33,6 +33,18 @@ class RoleTest < ActiveSupport::TestCase
assert_equal Role.all.reject(&:builtin?).sort, Role.builtin(false).all.sort
end
+ def test_copy_from
+ role = Role.find(1)
+ copy = Role.new.copy_from(role)
+
+ assert_nil copy.id
+ assert_equal '', copy.name
+ assert_equal role.permissions, copy.permissions
+
+ copy.name = 'Copy'
+ assert copy.save
+ end
+
def test_copy_workflows
source = Role.find(1)
assert_equal 90, source.workflow_rules.size