Mercurial > hg > soundsoftware-site
comparison test/functional/roles_controller_test.rb @ 1526:404aa68d4227
Merge from live branch
| author | Chris Cannam |
|---|---|
| date | Thu, 11 Sep 2014 12:46:20 +0100 |
| parents | e248c7af89ec |
| children |
comparison
equal
deleted
inserted
replaced
| 1493:a5f2bdf3b486 | 1526:404aa68d4227 |
|---|---|
| 1 # Redmine - project management software | 1 # Redmine - project management software |
| 2 # Copyright (C) 2006-2012 Jean-Philippe Lang | 2 # Copyright (C) 2006-2014 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' } |
