From a8e37594588721df8afcafa23e3851eb67aaec10 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 6 Dec 2014 13:16:43 +0000 Subject: [PATCH] Adds tests for Role#has_permissions? git-svn-id: http://svn.redmine.org/redmine/trunk@13725 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/unit/role_test.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 -- 2.39.5