##// END OF EJS Templates
remove trailing white-spaces from test/functional/groups_controller_test.rb....
Toshi MARUYAMA -
r6809:db6c54072d37
parent child
Show More
@@ -1,16 +1,16
1 # Redmine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2009 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.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
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.
@@ -23,7 +23,7 class GroupsController; def rescue_action(e) raise e end; end
23
23
24 class GroupsControllerTest < ActionController::TestCase
24 class GroupsControllerTest < ActionController::TestCase
25 fixtures :projects, :users, :members, :member_roles, :groups_users
25 fixtures :projects, :users, :members, :member_roles, :groups_users
26
26
27 def setup
27 def setup
28 @controller = GroupsController.new
28 @controller = GroupsController.new
29 @request = ActionController::TestRequest.new
29 @request = ActionController::TestRequest.new
@@ -31,87 +31,87 class GroupsControllerTest < ActionController::TestCase
31 User.current = nil
31 User.current = nil
32 @request.session[:user_id] = 1
32 @request.session[:user_id] = 1
33 end
33 end
34
34
35 def test_index
35 def test_index
36 get :index
36 get :index
37 assert_response :success
37 assert_response :success
38 assert_template 'index'
38 assert_template 'index'
39 end
39 end
40
40
41 def test_show
41 def test_show
42 get :show, :id => 10
42 get :show, :id => 10
43 assert_response :success
43 assert_response :success
44 assert_template 'show'
44 assert_template 'show'
45 end
45 end
46
46
47 def test_new
47 def test_new
48 get :new
48 get :new
49 assert_response :success
49 assert_response :success
50 assert_template 'new'
50 assert_template 'new'
51 end
51 end
52
52
53 def test_create
53 def test_create
54 assert_difference 'Group.count' do
54 assert_difference 'Group.count' do
55 post :create, :group => {:lastname => 'New group'}
55 post :create, :group => {:lastname => 'New group'}
56 end
56 end
57 assert_redirected_to '/groups'
57 assert_redirected_to '/groups'
58 end
58 end
59
59
60 def test_create_and_continue
60 def test_create_and_continue
61 assert_difference 'Group.count' do
61 assert_difference 'Group.count' do
62 post :create, :group => {:lastname => 'New group'}, :continue => 'Create and continue'
62 post :create, :group => {:lastname => 'New group'}, :continue => 'Create and continue'
63 end
63 end
64 assert_redirected_to '/groups/new'
64 assert_redirected_to '/groups/new'
65 end
65 end
66
66
67 def test_edit
67 def test_edit
68 get :edit, :id => 10
68 get :edit, :id => 10
69 assert_response :success
69 assert_response :success
70 assert_template 'edit'
70 assert_template 'edit'
71 end
71 end
72
72
73 def test_update
73 def test_update
74 post :update, :id => 10
74 post :update, :id => 10
75 assert_redirected_to '/groups'
75 assert_redirected_to '/groups'
76 end
76 end
77
77
78 def test_destroy
78 def test_destroy
79 assert_difference 'Group.count', -1 do
79 assert_difference 'Group.count', -1 do
80 post :destroy, :id => 10
80 post :destroy, :id => 10
81 end
81 end
82 assert_redirected_to '/groups'
82 assert_redirected_to '/groups'
83 end
83 end
84
84
85 def test_add_users
85 def test_add_users
86 assert_difference 'Group.find(10).users.count', 2 do
86 assert_difference 'Group.find(10).users.count', 2 do
87 post :add_users, :id => 10, :user_ids => ['2', '3']
87 post :add_users, :id => 10, :user_ids => ['2', '3']
88 end
88 end
89 end
89 end
90
90
91 def test_remove_user
91 def test_remove_user
92 assert_difference 'Group.find(10).users.count', -1 do
92 assert_difference 'Group.find(10).users.count', -1 do
93 post :remove_user, :id => 10, :user_id => '8'
93 post :remove_user, :id => 10, :user_id => '8'
94 end
94 end
95 end
95 end
96
96
97 def test_new_membership
97 def test_new_membership
98 assert_difference 'Group.find(10).members.count' do
98 assert_difference 'Group.find(10).members.count' do
99 post :edit_membership, :id => 10, :membership => { :project_id => 2, :role_ids => ['1', '2']}
99 post :edit_membership, :id => 10, :membership => { :project_id => 2, :role_ids => ['1', '2']}
100 end
100 end
101 end
101 end
102
102
103 def test_edit_membership
103 def test_edit_membership
104 assert_no_difference 'Group.find(10).members.count' do
104 assert_no_difference 'Group.find(10).members.count' do
105 post :edit_membership, :id => 10, :membership_id => 6, :membership => { :role_ids => ['1', '3']}
105 post :edit_membership, :id => 10, :membership_id => 6, :membership => { :role_ids => ['1', '3']}
106 end
106 end
107 end
107 end
108
108
109 def test_destroy_membership
109 def test_destroy_membership
110 assert_difference 'Group.find(10).members.count', -1 do
110 assert_difference 'Group.find(10).members.count', -1 do
111 post :destroy_membership, :id => 10, :membership_id => 6
111 post :destroy_membership, :id => 10, :membership_id => 6
112 end
112 end
113 end
113 end
114
114
115 def test_autocomplete_for_user
115 def test_autocomplete_for_user
116 get :autocomplete_for_user, :id => 10, :q => 'mis'
116 get :autocomplete_for_user, :id => 10, :q => 'mis'
117 assert_response :success
117 assert_response :success
General Comments 0
You need to be logged in to leave comments. Login now