comparison test/functional/users_controller_test.rb @ 442:753f1380d6bc cannam

Merge from branch "redmine-1.2"
author Chris Cannam
date Mon, 06 Jun 2011 14:41:04 +0100
parents cbce1fd3b1b7
children cbb26bc654de
comparison
equal deleted inserted replaced
252:adc8466df404 442:753f1380d6bc
1 # redMine - project management software 1 # Redmine - project management software
2 # Copyright (C) 2006-2007 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.
22 class UsersController; def rescue_action(e) raise e end; end 22 class UsersController; def rescue_action(e) raise e end; end
23 23
24 class UsersControllerTest < ActionController::TestCase 24 class UsersControllerTest < ActionController::TestCase
25 include Redmine::I18n 25 include Redmine::I18n
26 26
27 fixtures :users, :projects, :members, :member_roles, :roles, :auth_sources, :custom_fields, :custom_values 27 fixtures :users, :projects, :members, :member_roles, :roles, :auth_sources, :custom_fields, :custom_values, :groups_users
28 28
29 def setup 29 def setup
30 @controller = UsersController.new 30 @controller = UsersController.new
31 @request = ActionController::TestRequest.new 31 @request = ActionController::TestRequest.new
32 @response = ActionController::TestResponse.new 32 @response = ActionController::TestResponse.new
55 assert_template 'index' 55 assert_template 'index'
56 users = assigns(:users) 56 users = assigns(:users)
57 assert_not_nil users 57 assert_not_nil users
58 assert_equal 1, users.size 58 assert_equal 1, users.size
59 assert_equal 'John', users.first.firstname 59 assert_equal 'John', users.first.firstname
60 end
61
62 def test_index_with_group_filter
63 get :index, :group_id => '10'
64 assert_response :success
65 assert_template 'index'
66 users = assigns(:users)
67 assert users.any?
68 assert_equal([], (users - Group.find(10).users))
60 end 69 end
61 70
62 def test_show 71 def test_show
63 @request.session[:user_id] = nil 72 @request.session[:user_id] = nil
64 get :show, :id => 2 73 get :show, :id => 2