##// END OF EJS Templates
Include missing fixtures....
Jean-Philippe Lang -
r2875:e117dc8c9cb3
parent child
Show More
@@ -1,107 +1,107
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2009 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.
17 17
18 18 require File.dirname(__FILE__) + '/../test_helper'
19 19 require 'groups_controller'
20 20
21 21 # Re-raise errors caught by the controller.
22 22 class GroupsController; def rescue_action(e) raise e end; end
23 23
24 24 class GroupsControllerTest < ActionController::TestCase
25 fixtures :projects, :users, :members, :member_roles
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
30 30 @response = ActionController::TestResponse.new
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_edit
61 61 get :edit, :id => 10
62 62 assert_response :success
63 63 assert_template 'edit'
64 64 end
65 65
66 66 def test_update
67 67 post :update, :id => 10
68 68 assert_redirected_to 'groups'
69 69 end
70 70
71 71 def test_destroy
72 72 assert_difference 'Group.count', -1 do
73 73 post :destroy, :id => 10
74 74 end
75 75 assert_redirected_to 'groups'
76 76 end
77 77
78 78 def test_add_users
79 79 assert_difference 'Group.find(10).users.count', 2 do
80 80 post :add_users, :id => 10, :user_ids => ['2', '3']
81 81 end
82 82 end
83 83
84 84 def test_remove_user
85 85 assert_difference 'Group.find(10).users.count', -1 do
86 86 post :remove_user, :id => 10, :user_id => '8'
87 87 end
88 88 end
89 89
90 90 def test_new_membership
91 91 assert_difference 'Group.find(10).members.count' do
92 92 post :edit_membership, :id => 10, :membership => { :project_id => 2, :role_ids => ['1', '2']}
93 93 end
94 94 end
95 95
96 96 def test_edit_membership
97 97 assert_no_difference 'Group.find(10).members.count' do
98 98 post :edit_membership, :id => 10, :membership_id => 6, :membership => { :role_ids => ['1', '3']}
99 99 end
100 100 end
101 101
102 102 def test_destroy_membership
103 103 assert_difference 'Group.find(10).members.count', -1 do
104 104 post :destroy_membership, :id => 10, :membership_id => 6
105 105 end
106 106 end
107 107 end
General Comments 0
You need to be logged in to leave comments. Login now