@@ -1,16 +1,16 | |||
|
1 | 1 | # Redmine - project management software |
|
2 |
# Copyright (C) 2006-20 |
|
|
2 | # Copyright (C) 2006-2011 Jean-Philippe Lang | |
|
3 | 3 | # |
|
4 | 4 | # This program is free software; you can redistribute it and/or |
|
5 | 5 | # modify it under the terms of the GNU General Public License |
|
6 | 6 | # as published by the Free Software Foundation; either version 2 |
|
7 | 7 | # of the License, or (at your option) any later version. |
|
8 |
# |
|
|
8 | # | |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 |
# |
|
|
13 | # | |
|
14 | 14 | # You should have received a copy of the GNU General Public License |
|
15 | 15 | # along with this program; if not, write to the Free Software |
|
16 | 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 | 24 | class GroupsControllerTest < ActionController::TestCase |
|
25 | 25 | fixtures :projects, :users, :members, :member_roles, :groups_users |
|
26 | ||
|
26 | ||
|
27 | 27 | def setup |
|
28 | 28 | @controller = GroupsController.new |
|
29 | 29 | @request = ActionController::TestRequest.new |
@@ -31,87 +31,87 class GroupsControllerTest < ActionController::TestCase | |||
|
31 | 31 | User.current = nil |
|
32 | 32 | @request.session[:user_id] = 1 |
|
33 | 33 | end |
|
34 | ||
|
34 | ||
|
35 | 35 | def test_index |
|
36 | 36 | get :index |
|
37 | 37 | assert_response :success |
|
38 | 38 | assert_template 'index' |
|
39 | 39 | end |
|
40 | ||
|
40 | ||
|
41 | 41 | def test_show |
|
42 | 42 | get :show, :id => 10 |
|
43 | 43 | assert_response :success |
|
44 | 44 | assert_template 'show' |
|
45 | 45 | end |
|
46 | ||
|
46 | ||
|
47 | 47 | def test_new |
|
48 | 48 | get :new |
|
49 | 49 | assert_response :success |
|
50 | 50 | assert_template 'new' |
|
51 | 51 | end |
|
52 | ||
|
52 | ||
|
53 | 53 | def test_create |
|
54 | 54 | assert_difference 'Group.count' do |
|
55 | 55 | post :create, :group => {:lastname => 'New group'} |
|
56 | 56 | end |
|
57 | 57 | assert_redirected_to '/groups' |
|
58 | 58 | end |
|
59 | ||
|
59 | ||
|
60 | 60 | def test_create_and_continue |
|
61 | 61 | assert_difference 'Group.count' do |
|
62 | 62 | post :create, :group => {:lastname => 'New group'}, :continue => 'Create and continue' |
|
63 | 63 | end |
|
64 | 64 | assert_redirected_to '/groups/new' |
|
65 | 65 | end |
|
66 | ||
|
66 | ||
|
67 | 67 | def test_edit |
|
68 | 68 | get :edit, :id => 10 |
|
69 | 69 | assert_response :success |
|
70 | 70 | assert_template 'edit' |
|
71 | 71 | end |
|
72 | ||
|
72 | ||
|
73 | 73 | def test_update |
|
74 | 74 | post :update, :id => 10 |
|
75 | 75 | assert_redirected_to '/groups' |
|
76 | 76 | end |
|
77 | ||
|
77 | ||
|
78 | 78 | def test_destroy |
|
79 | 79 | assert_difference 'Group.count', -1 do |
|
80 | 80 | post :destroy, :id => 10 |
|
81 | 81 | end |
|
82 | 82 | assert_redirected_to '/groups' |
|
83 | 83 | end |
|
84 | ||
|
84 | ||
|
85 | 85 | def test_add_users |
|
86 | 86 | assert_difference 'Group.find(10).users.count', 2 do |
|
87 | 87 | post :add_users, :id => 10, :user_ids => ['2', '3'] |
|
88 | 88 | end |
|
89 | 89 | end |
|
90 | ||
|
90 | ||
|
91 | 91 | def test_remove_user |
|
92 | 92 | assert_difference 'Group.find(10).users.count', -1 do |
|
93 | 93 | post :remove_user, :id => 10, :user_id => '8' |
|
94 | 94 | end |
|
95 | 95 | end |
|
96 | ||
|
96 | ||
|
97 | 97 | def test_new_membership |
|
98 | 98 | assert_difference 'Group.find(10).members.count' do |
|
99 | 99 | post :edit_membership, :id => 10, :membership => { :project_id => 2, :role_ids => ['1', '2']} |
|
100 | 100 | end |
|
101 | 101 | end |
|
102 | ||
|
102 | ||
|
103 | 103 | def test_edit_membership |
|
104 | 104 | assert_no_difference 'Group.find(10).members.count' do |
|
105 | 105 | post :edit_membership, :id => 10, :membership_id => 6, :membership => { :role_ids => ['1', '3']} |
|
106 | 106 | end |
|
107 | 107 | end |
|
108 | ||
|
108 | ||
|
109 | 109 | def test_destroy_membership |
|
110 | 110 | assert_difference 'Group.find(10).members.count', -1 do |
|
111 | 111 | post :destroy_membership, :id => 10, :membership_id => 6 |
|
112 | 112 | end |
|
113 | 113 | end |
|
114 | ||
|
114 | ||
|
115 | 115 | def test_autocomplete_for_user |
|
116 | 116 | get :autocomplete_for_user, :id => 10, :q => 'mis' |
|
117 | 117 | assert_response :success |
General Comments 0
You need to be logged in to leave comments.
Login now