Commit b4d9cf762bc15482d178a8329b74f1a2d006e7e3
1 parent
1a09e97d
Exists in
master
and in
29 other branches
ActionItem35: not allowing to change key of system roles
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1848 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
1 changed file
with
18 additions
and
0 deletions
Show diff stats
vendor/plugins/access_control/test/role_test.rb
... | ... | @@ -73,4 +73,22 @@ class RoleTest < Test::Unit::TestCase |
73 | 73 | assert_equal [], role.permissions |
74 | 74 | end |
75 | 75 | |
76 | + def test_should_not_allow_changing_key_of_system_roles | |
77 | + role = Role.create!(:name => 'a test role', :system => true, :key => 'some_unprobable_key') | |
78 | + | |
79 | + assert_raise(ArgumentError) do | |
80 | + role.key = 'another_key' | |
81 | + end | |
82 | + assert_equal 'some_unprobable_key', role.key | |
83 | + end | |
84 | + | |
85 | + def test_should_allow_changing_key_of_non_system_role | |
86 | + role = Role.create!(:name => 'a test role', :system => false, :key => 'some_unprobable_key') | |
87 | + | |
88 | + assert_nothing_raised do | |
89 | + role.key = 'another_key' | |
90 | + end | |
91 | + assert_equal 'another_key', role.key | |
92 | + end | |
93 | + | |
76 | 94 | end | ... | ... |