comparison test/functional/roles_controller_test.rb @ 1298:4f746d8966dd redmine_2.3_integration

Merge from redmine-2.3 branch to create new branch redmine-2.3-integration
author Chris Cannam
date Fri, 14 Jun 2013 09:28:30 +0100
parents 622f24f53b42
children e248c7af89ec
comparison
equal deleted inserted replaced
1297:0a574315af3e 1298:4f746d8966dd
1 # Redmine - project management software 1 # Redmine - project management software
2 # Copyright (C) 2006-2012 Jean-Philippe Lang 2 # Copyright (C) 2006-2013 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.
19 19
20 class RolesControllerTest < ActionController::TestCase 20 class RolesControllerTest < ActionController::TestCase
21 fixtures :roles, :users, :members, :member_roles, :workflows, :trackers 21 fixtures :roles, :users, :members, :member_roles, :workflows, :trackers
22 22
23 def setup 23 def setup
24 @controller = RolesController.new
25 @request = ActionController::TestRequest.new
26 @response = ActionController::TestResponse.new
27 User.current = nil 24 User.current = nil
28 @request.session[:user_id] = 1 # admin 25 @request.session[:user_id] = 1 # admin
29 end 26 end
30 27
31 def test_index 28 def test_index
32 get :index 29 get :index
33 assert_response :success 30 assert_response :success
34 assert_template 'index' 31 assert_template 'index'
35 32
36 assert_not_nil assigns(:roles) 33 assert_not_nil assigns(:roles)
37 assert_equal Role.find(:all, :order => 'builtin, position'), assigns(:roles) 34 assert_equal Role.order('builtin, position').all, assigns(:roles)
38 35
39 assert_tag :tag => 'a', :attributes => { :href => '/roles/1/edit' }, 36 assert_tag :tag => 'a', :attributes => { :href => '/roles/1/edit' },
40 :content => 'Manager' 37 :content => 'Manager'
41 end 38 end
42 39
161 get :permissions 158 get :permissions
162 assert_response :success 159 assert_response :success
163 assert_template 'permissions' 160 assert_template 'permissions'
164 161
165 assert_not_nil assigns(:roles) 162 assert_not_nil assigns(:roles)
166 assert_equal Role.find(:all, :order => 'builtin, position'), assigns(:roles) 163 assert_equal Role.order('builtin, position').all, assigns(:roles)
167 164
168 assert_tag :tag => 'input', :attributes => { :type => 'checkbox', 165 assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
169 :name => 'permissions[3][]', 166 :name => 'permissions[3][]',
170 :value => 'add_issues', 167 :value => 'add_issues',
171 :checked => 'checked' } 168 :checked => 'checked' }