comparison test/unit/role_test.rb @ 511:107d36338b70 live

Merge from branch "cannam"
author Chris Cannam
date Thu, 14 Jul 2011 10:43:07 +0100
parents cbce1fd3b1b7
children cbb26bc654de
comparison
equal deleted inserted replaced
451:a9f6345cb43d 511:107d36338b70
1 # redMine - project management software 1 # Redmine - project management software
2 # Copyright (C) 2006-2008 Jean-Philippe Lang 2 # Copyright (C) 2006-2011 Jean-Philippe Lang
3 # 3 #
4 # This program is free software; you can redistribute it and/or 4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License 5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2 6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version. 7 # of the License, or (at your option) any later version.
13 # 13 #
14 # You should have received a copy of the GNU General Public License 14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software 15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 require File.dirname(__FILE__) + '/../test_helper' 18 require File.expand_path('../../test_helper', __FILE__)
19 19
20 class RoleTest < ActiveSupport::TestCase 20 class RoleTest < ActiveSupport::TestCase
21 fixtures :roles, :workflows 21 fixtures :roles, :workflows
22 22
23 def test_copy_workflows 23 def test_copy_workflows
46 perm = role.permissions[0..1] 46 perm = role.permissions[0..1]
47 role.remove_permission!(*perm) 47 role.remove_permission!(*perm)
48 role.reload 48 role.reload
49 assert ! role.permissions.include?(perm[0]) 49 assert ! role.permissions.include?(perm[0])
50 assert_equal size - 2, role.permissions.size 50 assert_equal size - 2, role.permissions.size
51 end
52
53 def test_name
54 I18n.locale = 'fr'
55 assert_equal 'Manager', Role.find(1).name
56 assert_equal 'Anonyme', Role.anonymous.name
57 assert_equal 'Non membre', Role.non_member.name
51 end 58 end
52 59
53 context "#anonymous" do 60 context "#anonymous" do
54 should "return the anonymous role" do 61 should "return the anonymous role" do
55 role = Role.anonymous 62 role = Role.anonymous