@@ -1,203 +1,221 | |||
|
1 | 1 | # Redmine - project management software |
|
2 | 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. |
|
17 | 17 | |
|
18 | 18 | require File.expand_path('../../../test_helper', __FILE__) |
|
19 | 19 | |
|
20 | 20 | class RoutingTimelogsTest < ActionController::IntegrationTest |
|
21 | 21 | def test_timelogs_global |
|
22 | 22 | assert_routing( |
|
23 | 23 | { :method => 'get', :path => "/time_entries" }, |
|
24 | 24 | { :controller => 'timelog', :action => 'index' } |
|
25 | 25 | ) |
|
26 | 26 | assert_routing( |
|
27 | 27 | { :method => 'get', :path => "/time_entries.csv" }, |
|
28 | 28 | { :controller => 'timelog', :action => 'index', :format => 'csv' } |
|
29 | 29 | ) |
|
30 | 30 | assert_routing( |
|
31 | 31 | { :method => 'get', :path => "/time_entries.atom" }, |
|
32 | 32 | { :controller => 'timelog', :action => 'index', :format => 'atom' } |
|
33 | 33 | ) |
|
34 | 34 | assert_routing( |
|
35 | 35 | { :method => 'get', :path => "/time_entries/new" }, |
|
36 | 36 | { :controller => 'timelog', :action => 'new' } |
|
37 | 37 | ) |
|
38 | 38 | assert_routing( |
|
39 | 39 | { :method => 'get', :path => "/time_entries/22/edit" }, |
|
40 | 40 | { :controller => 'timelog', :action => 'edit', :id => '22' } |
|
41 | 41 | ) |
|
42 | 42 | assert_routing( |
|
43 | 43 | { :method => 'post', :path => "/time_entries" }, |
|
44 | 44 | { :controller => 'timelog', :action => 'create' } |
|
45 | 45 | ) |
|
46 | 46 | assert_routing( |
|
47 | 47 | { :method => 'put', :path => "/time_entries/22" }, |
|
48 | 48 | { :controller => 'timelog', :action => 'update', :id => '22' } |
|
49 | 49 | ) |
|
50 | 50 | assert_routing( |
|
51 | 51 | { :method => 'delete', :path => "/time_entries/55" }, |
|
52 | 52 | { :controller => 'timelog', :action => 'destroy', :id => '55' } |
|
53 | 53 | ) |
|
54 | 54 | end |
|
55 | 55 | |
|
56 | 56 | def test_timelogs_scoped_under_project |
|
57 | 57 | assert_routing( |
|
58 | 58 | { :method => 'get', :path => "/projects/567/time_entries" }, |
|
59 | 59 | { :controller => 'timelog', :action => 'index', :project_id => '567' } |
|
60 | 60 | ) |
|
61 | 61 | assert_routing( |
|
62 | 62 | { :method => 'get', :path => "/projects/567/time_entries.csv" }, |
|
63 | 63 | { :controller => 'timelog', :action => 'index', :project_id => '567', |
|
64 | 64 | :format => 'csv' } |
|
65 | 65 | ) |
|
66 | 66 | assert_routing( |
|
67 | 67 | { :method => 'get', :path => "/projects/567/time_entries.atom" }, |
|
68 | 68 | { :controller => 'timelog', :action => 'index', :project_id => '567', |
|
69 | 69 | :format => 'atom' } |
|
70 | 70 | ) |
|
71 | 71 | assert_routing( |
|
72 | 72 | { :method => 'get', :path => "/projects/567/time_entries/new" }, |
|
73 | 73 | { :controller => 'timelog', :action => 'new', :project_id => '567' } |
|
74 | 74 | ) |
|
75 | 75 | assert_routing( |
|
76 | 76 | { :method => 'get', :path => "/projects/567/time_entries/22/edit" }, |
|
77 | 77 | { :controller => 'timelog', :action => 'edit', |
|
78 | 78 | :id => '22', :project_id => '567' } |
|
79 | 79 | ) |
|
80 | 80 | assert_routing( |
|
81 | 81 | { :method => 'post', :path => "/projects/567/time_entries" }, |
|
82 | 82 | { :controller => 'timelog', :action => 'create', |
|
83 | 83 | :project_id => '567' } |
|
84 | 84 | ) |
|
85 | 85 | assert_routing( |
|
86 | 86 | { :method => 'put', :path => "/projects/567/time_entries/22" }, |
|
87 | 87 | { :controller => 'timelog', :action => 'update', |
|
88 | 88 | :id => '22', :project_id => '567' } |
|
89 | 89 | ) |
|
90 | 90 | assert_routing( |
|
91 | 91 | { :method => 'delete', :path => "/projects/567/time_entries/55" }, |
|
92 | 92 | { :controller => 'timelog', :action => 'destroy', |
|
93 | 93 | :id => '55', :project_id => '567' } |
|
94 | 94 | ) |
|
95 | 95 | end |
|
96 | 96 | |
|
97 | 97 | def test_timelogs_scoped_under_issues |
|
98 | 98 | assert_routing( |
|
99 | 99 | { :method => 'get', :path => "/issues/234/time_entries" }, |
|
100 | 100 | { :controller => 'timelog', :action => 'index', :issue_id => '234' } |
|
101 | 101 | ) |
|
102 | 102 | assert_routing( |
|
103 | 103 | { :method => 'get', :path => "/issues/234/time_entries.csv" }, |
|
104 | 104 | { :controller => 'timelog', :action => 'index', :issue_id => '234', |
|
105 | 105 | :format => 'csv' } |
|
106 | 106 | ) |
|
107 | 107 | assert_routing( |
|
108 | 108 | { :method => 'get', :path => "/issues/234/time_entries.atom" }, |
|
109 | 109 | { :controller => 'timelog', :action => 'index', :issue_id => '234', |
|
110 | 110 | :format => 'atom' } |
|
111 | 111 | ) |
|
112 | 112 | assert_routing( |
|
113 | 113 | { :method => 'get', :path => "/issues/234/time_entries/new" }, |
|
114 | 114 | { :controller => 'timelog', :action => 'new', :issue_id => '234' } |
|
115 | 115 | ) |
|
116 | 116 | assert_routing( |
|
117 | 117 | { :method => 'get', :path => "/issues/234/time_entries/22/edit" }, |
|
118 | 118 | { :controller => 'timelog', :action => 'edit', :id => '22', |
|
119 | 119 | :issue_id => '234' } |
|
120 | 120 | ) |
|
121 | 121 | assert_routing( |
|
122 | 122 | { :method => 'post', :path => "/issues/234/time_entries" }, |
|
123 | 123 | { :controller => 'timelog', :action => 'create', :issue_id => '234' } |
|
124 | 124 | ) |
|
125 | 125 | assert_routing( |
|
126 | 126 | { :method => 'put', :path => "/issues/234/time_entries/22" }, |
|
127 | 127 | { :controller => 'timelog', :action => 'update', :id => '22', |
|
128 | 128 | :issue_id => '234' } |
|
129 | 129 | ) |
|
130 | 130 | assert_routing( |
|
131 | 131 | { :method => 'delete', :path => "/issues/234/time_entries/55" }, |
|
132 | 132 | { :controller => 'timelog', :action => 'destroy', :id => '55', |
|
133 | 133 | :issue_id => '234' } |
|
134 | 134 | ) |
|
135 | 135 | end |
|
136 | 136 | |
|
137 | 137 | def test_timelogs_scoped_under_project_and_issues |
|
138 | 138 | assert_routing( |
|
139 | 139 | { :method => 'get', |
|
140 | 140 | :path => "/projects/ecookbook/issues/234/time_entries" }, |
|
141 | 141 | { :controller => 'timelog', :action => 'index', |
|
142 | 142 | :issue_id => '234', :project_id => 'ecookbook' } |
|
143 | 143 | ) |
|
144 | 144 | assert_routing( |
|
145 | 145 | { :method => 'get', |
|
146 | 146 | :path => "/projects/ecookbook/issues/234/time_entries.csv" }, |
|
147 | 147 | { :controller => 'timelog', :action => 'index', |
|
148 | 148 | :issue_id => '234', :project_id => 'ecookbook', :format => 'csv' } |
|
149 | 149 | ) |
|
150 | 150 | assert_routing( |
|
151 | 151 | { :method => 'get', |
|
152 | 152 | :path => "/projects/ecookbook/issues/234/time_entries.atom" }, |
|
153 | 153 | { :controller => 'timelog', :action => 'index', |
|
154 | 154 | :issue_id => '234', :project_id => 'ecookbook', :format => 'atom' } |
|
155 | 155 | ) |
|
156 | 156 | assert_routing( |
|
157 | 157 | { :method => 'get', |
|
158 | 158 | :path => "/projects/ecookbook/issues/234/time_entries/new" }, |
|
159 | 159 | { :controller => 'timelog', :action => 'new', |
|
160 | 160 | :issue_id => '234', :project_id => 'ecookbook' } |
|
161 | 161 | ) |
|
162 | 162 | assert_routing( |
|
163 | 163 | { :method => 'get', |
|
164 | 164 | :path => "/projects/ecookbook/issues/234/time_entries/22/edit" }, |
|
165 | 165 | { :controller => 'timelog', :action => 'edit', :id => '22', |
|
166 | 166 | :issue_id => '234', :project_id => 'ecookbook' } |
|
167 | 167 | ) |
|
168 | 168 | assert_routing( |
|
169 | 169 | { :method => 'post', |
|
170 | 170 | :path => "/projects/ecookbook/issues/234/time_entries" }, |
|
171 | 171 | { :controller => 'timelog', :action => 'create', |
|
172 | 172 | :issue_id => '234', :project_id => 'ecookbook' } |
|
173 | 173 | ) |
|
174 | 174 | assert_routing( |
|
175 | 175 | { :method => 'put', |
|
176 | 176 | :path => "/projects/ecookbook/issues/234/time_entries/22" }, |
|
177 | 177 | { :controller => 'timelog', :action => 'update', :id => '22', |
|
178 | 178 | :issue_id => '234', :project_id => 'ecookbook' } |
|
179 | 179 | ) |
|
180 | 180 | assert_routing( |
|
181 | 181 | { :method => 'delete', |
|
182 | 182 | :path => "/projects/ecookbook/issues/234/time_entries/55" }, |
|
183 | 183 | { :controller => 'timelog', :action => 'destroy', :id => '55', |
|
184 | 184 | :issue_id => '234', :project_id => 'ecookbook' } |
|
185 | 185 | ) |
|
186 | 186 | assert_routing( |
|
187 | 187 | { :method => 'get', |
|
188 | 188 | :path => "/time_entries/report" }, |
|
189 | 189 | { :controller => 'timelog', :action => 'report' } |
|
190 | 190 | ) |
|
191 | 191 | assert_routing( |
|
192 | 192 | { :method => 'get', |
|
193 | 193 | :path => "/projects/567/time_entries/report" }, |
|
194 | 194 | { :controller => 'timelog', :action => 'report', :project_id => '567' } |
|
195 | 195 | ) |
|
196 | 196 | assert_routing( |
|
197 | 197 | { :method => 'get', |
|
198 | 198 | :path => "/projects/567/time_entries/report.csv" }, |
|
199 | 199 | { :controller => 'timelog', :action => 'report', :project_id => '567', |
|
200 | 200 | :format => 'csv' } |
|
201 | 201 | ) |
|
202 | 202 | end |
|
203 | ||
|
204 | def test_timelogs_bulk_edit | |
|
205 | assert_routing( | |
|
206 | { :method => 'delete', | |
|
207 | :path => "/time_entries/destroy" }, | |
|
208 | { :controller => 'timelog', :action => 'destroy' } | |
|
209 | ) | |
|
210 | assert_routing( | |
|
211 | { :method => 'post', | |
|
212 | :path => "/time_entries/bulk_update" }, | |
|
213 | { :controller => 'timelog', :action => 'bulk_update' } | |
|
214 | ) | |
|
215 | assert_routing( | |
|
216 | { :method => 'get', | |
|
217 | :path => "/time_entries/bulk_edit" }, | |
|
218 | { :controller => 'timelog', :action => 'bulk_edit' } | |
|
219 | ) | |
|
220 | end | |
|
203 | 221 | end |
General Comments 0
You need to be logged in to leave comments.
Login now