summaryrefslogtreecommitdiffstats
path: root/test/unit/role_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-12-06 13:16:43 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-12-06 13:16:43 +0000
commita8e37594588721df8afcafa23e3851eb67aaec10 (patch)
tree3c9a292ddeea37c20fceb3be038837514e9b9d36 /test/unit/role_test.rb
parent43b3455111391b1b578b3319fd02001c08783830 (diff)
downloadredmine-a8e37594588721df8afcafa23e3851eb67aaec10.tar.gz
redmine-a8e37594588721df8afcafa23e3851eb67aaec10.zip
Adds tests for Role#has_permissions?
git-svn-id: http://svn.redmine.org/redmine/trunk@13725 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/role_test.rb')
-rw-r--r--test/unit/role_test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/unit/role_test.rb b/test/unit/role_test.rb
index e1ba993ee..6f9289964 100644
--- a/test/unit/role_test.rb
+++ b/test/unit/role_test.rb
@@ -80,6 +80,17 @@ class RoleTest < ActiveSupport::TestCase
assert_equal size - 2, role.permissions.size
end
+ def test_has_permission
+ role = Role.create!(:name => 'Test', :permissions => [:view_issues, :edit_issues])
+ assert_equal true, role.has_permission?(:view_issues)
+ assert_equal false, role.has_permission?(:delete_issues)
+ end
+
+ def test_has_permission_without_permissions
+ role = Role.create!(:name => 'Test')
+ assert_equal false, role.has_permission?(:delete_issues)
+ end
+
def test_name
I18n.locale = 'fr'
assert_equal 'Manager', Role.find(1).name