##// END OF EJS Templates
test: route: move boards test to new file...
Toshi MARUYAMA -
r8200:a8186713ba7d
parent child
Show More
@@ -0,0 +1,60
1 # Redmine - project management software
2 # Copyright (C) 2006-2011 Jean-Philippe Lang
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
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
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
18 require File.expand_path('../../../test_helper', __FILE__)
19
20 class RoutingBoardsTest < ActionController::IntegrationTest
21 def test_boards
22 assert_routing(
23 { :method => 'get', :path => "/projects/world_domination/boards" },
24 { :controller => 'boards', :action => 'index', :project_id => 'world_domination' }
25 )
26 assert_routing(
27 { :method => 'get', :path => "/projects/world_domination/boards/new" },
28 { :controller => 'boards', :action => 'new', :project_id => 'world_domination' }
29 )
30 assert_routing(
31 { :method => 'get', :path => "/projects/world_domination/boards/44" },
32 { :controller => 'boards', :action => 'show', :project_id => 'world_domination',
33 :id => '44' }
34 )
35 assert_routing(
36 { :method => 'get', :path => "/projects/world_domination/boards/44.atom" },
37 { :controller => 'boards', :action => 'show', :project_id => 'world_domination',
38 :id => '44', :format => 'atom' }
39 )
40 assert_routing(
41 { :method => 'get', :path => "/projects/world_domination/boards/44/edit" },
42 { :controller => 'boards', :action => 'edit', :project_id => 'world_domination',
43 :id => '44' }
44 )
45 assert_routing(
46 { :method => 'post', :path => "/projects/world_domination/boards" },
47 { :controller => 'boards', :action => 'create', :project_id => 'world_domination' }
48 )
49 assert_routing(
50 { :method => 'put', :path => "/projects/world_domination/boards/44" },
51 { :controller => 'boards', :action => 'update', :project_id => 'world_domination',
52 :id => '44' }
53 )
54 assert_routing(
55 { :method => 'delete', :path => "/projects/world_domination/boards/44" },
56 { :controller => 'boards', :action => 'destroy', :project_id => 'world_domination',
57 :id => '44' }
58 )
59 end
60 end
@@ -1,1354 +1,1316
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 RoutingTest < ActionController::IntegrationTest
21 def test_boards
22 assert_routing(
23 { :method => 'get', :path => "/projects/world_domination/boards" },
24 { :controller => 'boards', :action => 'index', :project_id => 'world_domination' }
25 )
26 assert_routing(
27 { :method => 'get', :path => "/projects/world_domination/boards/new" },
28 { :controller => 'boards', :action => 'new', :project_id => 'world_domination' }
29 )
30 assert_routing(
31 { :method => 'get', :path => "/projects/world_domination/boards/44" },
32 { :controller => 'boards', :action => 'show', :project_id => 'world_domination',
33 :id => '44' }
34 )
35 assert_routing(
36 { :method => 'get', :path => "/projects/world_domination/boards/44.atom" },
37 { :controller => 'boards', :action => 'show', :project_id => 'world_domination',
38 :id => '44', :format => 'atom' }
39 )
40 assert_routing(
41 { :method => 'get', :path => "/projects/world_domination/boards/44/edit" },
42 { :controller => 'boards', :action => 'edit', :project_id => 'world_domination',
43 :id => '44' }
44 )
45 assert_routing(
46 { :method => 'post', :path => "/projects/world_domination/boards" },
47 { :controller => 'boards', :action => 'create', :project_id => 'world_domination' }
48 )
49 assert_routing(
50 { :method => 'put', :path => "/projects/world_domination/boards/44" },
51 { :controller => 'boards', :action => 'update', :project_id => 'world_domination', :id => '44' }
52 )
53 assert_routing(
54 { :method => 'delete', :path => "/projects/world_domination/boards/44" },
55 { :controller => 'boards', :action => 'destroy', :project_id => 'world_domination', :id => '44' }
56 )
57 end
58
59 21 def test_custom_fields
60 22 assert_routing(
61 23 { :method => 'get', :path => "/custom_fields" },
62 24 { :controller => 'custom_fields', :action => 'index' }
63 25 )
64 26 assert_routing(
65 27 { :method => 'get', :path => "/custom_fields/new" },
66 28 { :controller => 'custom_fields', :action => 'new' }
67 29 )
68 30 assert_routing(
69 31 { :method => 'post', :path => "/custom_fields" },
70 32 { :controller => 'custom_fields', :action => 'create' }
71 33 )
72 34 assert_routing(
73 35 { :method => 'get', :path => "/custom_fields/2/edit" },
74 36 { :controller => 'custom_fields', :action => 'edit', :id => '2' }
75 37 )
76 38 assert_routing(
77 39 { :method => 'put', :path => "/custom_fields/2" },
78 40 { :controller => 'custom_fields', :action => 'update', :id => '2' }
79 41 )
80 42 assert_routing(
81 43 { :method => 'delete', :path => "/custom_fields/2" },
82 44 { :controller => 'custom_fields', :action => 'destroy', :id => '2' }
83 45 )
84 46 end
85 47
86 48 def test_documents
87 49 assert_routing(
88 50 { :method => 'get', :path => "/projects/567/documents" },
89 51 { :controller => 'documents', :action => 'index', :project_id => '567' }
90 52 )
91 53 assert_routing(
92 54 { :method => 'get', :path => "/projects/567/documents/new" },
93 55 { :controller => 'documents', :action => 'new', :project_id => '567' }
94 56 )
95 57 assert_routing(
96 58 { :method => 'get', :path => "/documents/22" },
97 59 { :controller => 'documents', :action => 'show', :id => '22' }
98 60 )
99 61 assert_routing(
100 62 { :method => 'get', :path => "/documents/22/edit" },
101 63 { :controller => 'documents', :action => 'edit', :id => '22' }
102 64 )
103 65 assert_routing(
104 66 { :method => 'post', :path => "/projects/567/documents" },
105 67 { :controller => 'documents', :action => 'create', :project_id => '567' }
106 68 )
107 69 assert_routing(
108 70 { :method => 'put', :path => "/documents/22" },
109 71 { :controller => 'documents', :action => 'update', :id => '22' }
110 72 )
111 73 assert_routing(
112 74 { :method => 'delete', :path => "/documents/22" },
113 75 { :controller => 'documents', :action => 'destroy', :id => '22' }
114 76 )
115 77 assert_routing(
116 78 { :method => 'post', :path => "/documents/22/add_attachment" },
117 79 { :controller => 'documents', :action => 'add_attachment', :id => '22' }
118 80 )
119 81 end
120 82
121 83 def test_roles
122 84 assert_routing(
123 85 { :method => 'get', :path => "/enumerations" },
124 86 { :controller => 'enumerations', :action => 'index' }
125 87 )
126 88 assert_routing(
127 89 { :method => 'get', :path => "/enumerations/new" },
128 90 { :controller => 'enumerations', :action => 'new' }
129 91 )
130 92 assert_routing(
131 93 { :method => 'post', :path => "/enumerations" },
132 94 { :controller => 'enumerations', :action => 'create' }
133 95 )
134 96 assert_routing(
135 97 { :method => 'get', :path => "/enumerations/2/edit" },
136 98 { :controller => 'enumerations', :action => 'edit', :id => '2' }
137 99 )
138 100 assert_routing(
139 101 { :method => 'put', :path => "/enumerations/2" },
140 102 { :controller => 'enumerations', :action => 'update', :id => '2' }
141 103 )
142 104 assert_routing(
143 105 { :method => 'delete', :path => "/enumerations/2" },
144 106 { :controller => 'enumerations', :action => 'destroy', :id => '2' }
145 107 )
146 108 end
147 109
148 110 def test_groups
149 111 assert_routing(
150 112 { :method => 'post', :path => "/groups/567/users" },
151 113 { :controller => 'groups', :action => 'add_users', :id => '567' }
152 114 )
153 115 assert_routing(
154 116 { :method => 'delete', :path => "/groups/567/users/12" },
155 117 { :controller => 'groups', :action => 'remove_user', :id => '567',
156 118 :user_id => '12' }
157 119 )
158 120 end
159 121
160 122 def test_issues_rest_actions
161 123 assert_routing(
162 124 { :method => 'get', :path => "/issues" },
163 125 { :controller => 'issues', :action => 'index' }
164 126 )
165 127 assert_routing(
166 128 { :method => 'get', :path => "/issues.pdf" },
167 129 { :controller => 'issues', :action => 'index', :format => 'pdf' }
168 130 )
169 131 assert_routing(
170 132 { :method => 'get', :path => "/issues.atom" },
171 133 { :controller => 'issues', :action => 'index', :format => 'atom' }
172 134 )
173 135 assert_routing(
174 136 { :method => 'get', :path => "/issues.xml" },
175 137 { :controller => 'issues', :action => 'index', :format => 'xml' }
176 138 )
177 139 assert_routing(
178 140 { :method => 'get', :path => "/projects/23/issues" },
179 141 { :controller => 'issues', :action => 'index', :project_id => '23' }
180 142 )
181 143 assert_routing(
182 144 { :method => 'get', :path => "/projects/23/issues.pdf" },
183 145 { :controller => 'issues', :action => 'index', :project_id => '23',
184 146 :format => 'pdf' }
185 147 )
186 148 assert_routing(
187 149 { :method => 'get', :path => "/projects/23/issues.atom" },
188 150 { :controller => 'issues', :action => 'index', :project_id => '23',
189 151 :format => 'atom' }
190 152 )
191 153 assert_routing(
192 154 { :method => 'get', :path => "/projects/23/issues.xml" },
193 155 { :controller => 'issues', :action => 'index', :project_id => '23',
194 156 :format => 'xml' }
195 157 )
196 158 assert_routing(
197 159 { :method => 'get', :path => "/issues/64" },
198 160 { :controller => 'issues', :action => 'show', :id => '64' }
199 161 )
200 162 assert_routing(
201 163 { :method => 'get', :path => "/issues/64.pdf" },
202 164 { :controller => 'issues', :action => 'show', :id => '64',
203 165 :format => 'pdf' }
204 166 )
205 167 assert_routing(
206 168 { :method => 'get', :path => "/issues/64.atom" },
207 169 { :controller => 'issues', :action => 'show', :id => '64',
208 170 :format => 'atom' }
209 171 )
210 172 assert_routing(
211 173 { :method => 'get', :path => "/issues/64.xml" },
212 174 { :controller => 'issues', :action => 'show', :id => '64',
213 175 :format => 'xml' }
214 176 )
215 177 assert_routing(
216 178 { :method => 'get', :path => "/projects/23/issues/new" },
217 179 { :controller => 'issues', :action => 'new', :project_id => '23' }
218 180 )
219 181 end
220 182
221 183 def test_issues_form_update
222 184 assert_routing(
223 185 { :method => 'post', :path => "/projects/23/issues/new" },
224 186 { :controller => 'issues', :action => 'new', :project_id => '23' }
225 187 )
226 188 assert_routing(
227 189 { :method => 'post', :path => "/projects/23/issues" },
228 190 { :controller => 'issues', :action => 'create', :project_id => '23' }
229 191 )
230 192 assert_routing(
231 193 { :method => 'post', :path => "/issues.xml" },
232 194 { :controller => 'issues', :action => 'create', :format => 'xml' }
233 195 )
234 196 assert_routing(
235 197 { :method => 'get', :path => "/issues/64/edit" },
236 198 { :controller => 'issues', :action => 'edit', :id => '64' }
237 199 )
238 200 assert_routing(
239 201 { :method => 'put', :path => "/issues/1.xml" },
240 202 { :controller => 'issues', :action => 'update', :id => '1',
241 203 :format => 'xml' }
242 204 )
243 205 assert_routing(
244 206 { :method => 'delete', :path => "/issues/1.xml" },
245 207 { :controller => 'issues', :action => 'destroy', :id => '1',
246 208 :format => 'xml' }
247 209 )
248 210 end
249 211
250 212 def test_issues_extra_actions
251 213 assert_routing(
252 214 { :method => 'get', :path => "/projects/23/issues/64/copy" },
253 215 { :controller => 'issues', :action => 'new', :project_id => '23',
254 216 :copy_from => '64' }
255 217 )
256 218 assert_routing(
257 219 { :method => 'get', :path => "/issues/move/new" },
258 220 { :controller => 'issue_moves', :action => 'new' }
259 221 )
260 222 assert_routing(
261 223 { :method => 'post', :path => "/issues/move" },
262 224 { :controller => 'issue_moves', :action => 'create' }
263 225 )
264 226 assert_routing(
265 227 { :method => 'post', :path => "/issues/1/quoted" },
266 228 { :controller => 'journals', :action => 'new', :id => '1' }
267 229 )
268 230 assert_routing(
269 231 { :method => 'get', :path => "/issues/calendar" },
270 232 { :controller => 'calendars', :action => 'show' }
271 233 )
272 234 assert_routing(
273 235 { :method => 'get', :path => "/projects/project-name/issues/calendar" },
274 236 { :controller => 'calendars', :action => 'show',
275 237 :project_id => 'project-name' }
276 238 )
277 239 assert_routing(
278 240 { :method => 'get', :path => "/issues/gantt" },
279 241 { :controller => 'gantts', :action => 'show' }
280 242 )
281 243 assert_routing(
282 244 { :method => 'get', :path => "/issues/gantt.pdf" },
283 245 { :controller => 'gantts', :action => 'show', :format => 'pdf' }
284 246 )
285 247 assert_routing(
286 248 { :method => 'get', :path => "/projects/project-name/issues/gantt" },
287 249 { :controller => 'gantts', :action => 'show',
288 250 :project_id => 'project-name' }
289 251 )
290 252 assert_routing(
291 253 { :method => 'get', :path => "/projects/project-name/issues/gantt.pdf" },
292 254 { :controller => 'gantts', :action => 'show',
293 255 :project_id => 'project-name', :format => 'pdf' }
294 256 )
295 257 assert_routing(
296 258 { :method => 'get', :path => "/issues/auto_complete" },
297 259 { :controller => 'auto_completes', :action => 'issues' }
298 260 )
299 261 assert_routing(
300 262 { :method => 'get', :path => "/issues/preview/123" },
301 263 { :controller => 'previews', :action => 'issue', :id => '123' }
302 264 )
303 265 assert_routing(
304 266 { :method => 'post', :path => "/issues/preview/123" },
305 267 { :controller => 'previews', :action => 'issue', :id => '123' }
306 268 )
307 269 assert_routing(
308 270 { :method => 'get', :path => "/issues/context_menu" },
309 271 { :controller => 'context_menus', :action => 'issues' }
310 272 )
311 273 assert_routing(
312 274 { :method => 'post', :path => "/issues/context_menu" },
313 275 { :controller => 'context_menus', :action => 'issues' }
314 276 )
315 277 assert_routing(
316 278 { :method => 'get', :path => "/issues/changes" },
317 279 { :controller => 'journals', :action => 'index' }
318 280 )
319 281 assert_routing(
320 282 { :method => 'get', :path => "/issues/bulk_edit" },
321 283 { :controller => 'issues', :action => 'bulk_edit' }
322 284 )
323 285 assert_routing(
324 286 { :method => 'post', :path => "/issues/bulk_update" },
325 287 { :controller => 'issues', :action => 'bulk_update' }
326 288 )
327 289 end
328 290
329 291 def test_issue_categories
330 292 assert_routing(
331 293 { :method => 'get', :path => "/projects/foo/issue_categories" },
332 294 { :controller => 'issue_categories', :action => 'index',
333 295 :project_id => 'foo' }
334 296 )
335 297 assert_routing(
336 298 { :method => 'get', :path => "/projects/foo/issue_categories.xml" },
337 299 { :controller => 'issue_categories', :action => 'index',
338 300 :project_id => 'foo', :format => 'xml' }
339 301 )
340 302 assert_routing(
341 303 { :method => 'get', :path => "/projects/foo/issue_categories.json" },
342 304 { :controller => 'issue_categories', :action => 'index',
343 305 :project_id => 'foo', :format => 'json' }
344 306 )
345 307 assert_routing(
346 308 { :method => 'get', :path => "/projects/foo/issue_categories/new" },
347 309 { :controller => 'issue_categories', :action => 'new',
348 310 :project_id => 'foo' }
349 311 )
350 312 assert_routing(
351 313 { :method => 'post', :path => "/projects/foo/issue_categories" },
352 314 { :controller => 'issue_categories', :action => 'create',
353 315 :project_id => 'foo' }
354 316 )
355 317 assert_routing(
356 318 { :method => 'post', :path => "/projects/foo/issue_categories.xml" },
357 319 { :controller => 'issue_categories', :action => 'create',
358 320 :project_id => 'foo', :format => 'xml' }
359 321 )
360 322 assert_routing(
361 323 { :method => 'post', :path => "/projects/foo/issue_categories.json" },
362 324 { :controller => 'issue_categories', :action => 'create',
363 325 :project_id => 'foo', :format => 'json' }
364 326 )
365 327 assert_routing(
366 328 { :method => 'get', :path => "/issue_categories/1" },
367 329 { :controller => 'issue_categories', :action => 'show', :id => '1' }
368 330 )
369 331 assert_routing(
370 332 { :method => 'get', :path => "/issue_categories/1.xml" },
371 333 { :controller => 'issue_categories', :action => 'show', :id => '1',
372 334 :format => 'xml' }
373 335 )
374 336 assert_routing(
375 337 { :method => 'get', :path => "/issue_categories/1.json" },
376 338 { :controller => 'issue_categories', :action => 'show', :id => '1',
377 339 :format => 'json' }
378 340 )
379 341 assert_routing(
380 342 { :method => 'get', :path => "/issue_categories/1/edit" },
381 343 { :controller => 'issue_categories', :action => 'edit', :id => '1' }
382 344 )
383 345 assert_routing(
384 346 { :method => 'put', :path => "/issue_categories/1" },
385 347 { :controller => 'issue_categories', :action => 'update', :id => '1' }
386 348 )
387 349 assert_routing(
388 350 { :method => 'put', :path => "/issue_categories/1.xml" },
389 351 { :controller => 'issue_categories', :action => 'update', :id => '1',
390 352 :format => 'xml' }
391 353 )
392 354 assert_routing(
393 355 { :method => 'put', :path => "/issue_categories/1.json" },
394 356 { :controller => 'issue_categories', :action => 'update', :id => '1',
395 357 :format => 'json' }
396 358 )
397 359 assert_routing(
398 360 { :method => 'delete', :path => "/issue_categories/1" },
399 361 { :controller => 'issue_categories', :action => 'destroy', :id => '1' }
400 362 )
401 363 assert_routing(
402 364 { :method => 'delete', :path => "/issue_categories/1.xml" },
403 365 { :controller => 'issue_categories', :action => 'destroy', :id => '1',
404 366 :format => 'xml' }
405 367 )
406 368 assert_routing(
407 369 { :method => 'delete', :path => "/issue_categories/1.json" },
408 370 { :controller => 'issue_categories', :action => 'destroy', :id => '1',
409 371 :format => 'json' }
410 372 )
411 373 end
412 374
413 375 def test_issue_relations
414 376 assert_routing(
415 377 { :method => 'get', :path => "/issues/1/relations" },
416 378 { :controller => 'issue_relations', :action => 'index',
417 379 :issue_id => '1' }
418 380 )
419 381 assert_routing(
420 382 { :method => 'get', :path => "/issues/1/relations.xml" },
421 383 { :controller => 'issue_relations', :action => 'index',
422 384 :issue_id => '1', :format => 'xml' }
423 385 )
424 386 assert_routing(
425 387 { :method => 'get', :path => "/issues/1/relations.json" },
426 388 { :controller => 'issue_relations', :action => 'index',
427 389 :issue_id => '1', :format => 'json' }
428 390 )
429 391 assert_routing(
430 392 { :method => 'post', :path => "/issues/1/relations" },
431 393 { :controller => 'issue_relations', :action => 'create',
432 394 :issue_id => '1' }
433 395 )
434 396 assert_routing(
435 397 { :method => 'post', :path => "/issues/1/relations.xml" },
436 398 { :controller => 'issue_relations', :action => 'create',
437 399 :issue_id => '1', :format => 'xml' }
438 400 )
439 401 assert_routing(
440 402 { :method => 'post', :path => "/issues/1/relations.json" },
441 403 { :controller => 'issue_relations', :action => 'create',
442 404 :issue_id => '1', :format => 'json' }
443 405 )
444 406 assert_routing(
445 407 { :method => 'get', :path => "/relations/23" },
446 408 { :controller => 'issue_relations', :action => 'show', :id => '23' }
447 409 )
448 410 assert_routing(
449 411 { :method => 'get', :path => "/relations/23.xml" },
450 412 { :controller => 'issue_relations', :action => 'show', :id => '23',
451 413 :format => 'xml' }
452 414 )
453 415 assert_routing(
454 416 { :method => 'get', :path => "/relations/23.json" },
455 417 { :controller => 'issue_relations', :action => 'show', :id => '23',
456 418 :format => 'json' }
457 419 )
458 420 assert_routing(
459 421 { :method => 'delete', :path => "/relations/23" },
460 422 { :controller => 'issue_relations', :action => 'destroy', :id => '23' }
461 423 )
462 424 assert_routing(
463 425 { :method => 'delete', :path => "/relations/23.xml" },
464 426 { :controller => 'issue_relations', :action => 'destroy', :id => '23',
465 427 :format => 'xml' }
466 428 )
467 429 assert_routing(
468 430 { :method => 'delete', :path => "/relations/23.json" },
469 431 { :controller => 'issue_relations', :action => 'destroy', :id => '23',
470 432 :format => 'json' }
471 433 )
472 434 end
473 435
474 436 def test_issue_reports
475 437 assert_routing(
476 438 { :method => 'get', :path => "/projects/567/issues/report" },
477 439 { :controller => 'reports', :action => 'issue_report', :id => '567' }
478 440 )
479 441 assert_routing(
480 442 { :method => 'get', :path => "/projects/567/issues/report/assigned_to" },
481 443 { :controller => 'reports', :action => 'issue_report_details',
482 444 :id => '567', :detail => 'assigned_to' }
483 445 )
484 446 end
485 447
486 448 def test_members
487 449 assert_routing(
488 450 { :method => 'post', :path => "/projects/5234/members/new" },
489 451 { :controller => 'members', :action => 'new', :id => '5234' }
490 452 )
491 453 end
492 454
493 455 def test_messages
494 456 assert_routing(
495 457 { :method => 'get', :path => "/boards/22/topics/2" },
496 458 { :controller => 'messages', :action => 'show', :id => '2',
497 459 :board_id => '22' }
498 460 )
499 461 assert_routing(
500 462 { :method => 'get', :path => "/boards/lala/topics/new" },
501 463 { :controller => 'messages', :action => 'new', :board_id => 'lala' }
502 464 )
503 465 assert_routing(
504 466 { :method => 'get', :path => "/boards/lala/topics/22/edit" },
505 467 { :controller => 'messages', :action => 'edit', :id => '22',
506 468 :board_id => 'lala' }
507 469 )
508 470 assert_routing(
509 471 { :method => 'post', :path => "/boards/lala/topics/new" },
510 472 { :controller => 'messages', :action => 'new', :board_id => 'lala' }
511 473 )
512 474 assert_routing(
513 475 { :method => 'post', :path => "/boards/lala/topics/22/edit" },
514 476 { :controller => 'messages', :action => 'edit', :id => '22',
515 477 :board_id => 'lala' }
516 478 )
517 479 assert_routing(
518 480 { :method => 'post', :path => "/boards/22/topics/555/replies" },
519 481 { :controller => 'messages', :action => 'reply', :id => '555',
520 482 :board_id => '22' }
521 483 )
522 484 assert_routing(
523 485 { :method => 'post', :path => "/boards/22/topics/555/destroy" },
524 486 { :controller => 'messages', :action => 'destroy', :id => '555',
525 487 :board_id => '22' }
526 488 )
527 489 end
528 490
529 491 def test_news
530 492 assert_routing(
531 493 { :method => 'get', :path => "/news" },
532 494 { :controller => 'news', :action => 'index' }
533 495 )
534 496 assert_routing(
535 497 { :method => 'get', :path => "/news.atom" },
536 498 { :controller => 'news', :action => 'index', :format => 'atom' }
537 499 )
538 500 assert_routing(
539 501 { :method => 'get', :path => "/news.xml" },
540 502 { :controller => 'news', :action => 'index', :format => 'xml' }
541 503 )
542 504 assert_routing(
543 505 { :method => 'get', :path => "/news.json" },
544 506 { :controller => 'news', :action => 'index', :format => 'json' }
545 507 )
546 508 assert_routing(
547 509 { :method => 'get', :path => "/projects/567/news" },
548 510 { :controller => 'news', :action => 'index', :project_id => '567' }
549 511 )
550 512 assert_routing(
551 513 { :method => 'get', :path => "/projects/567/news.atom" },
552 514 { :controller => 'news', :action => 'index', :format => 'atom',
553 515 :project_id => '567' }
554 516 )
555 517 assert_routing(
556 518 { :method => 'get', :path => "/projects/567/news.xml" },
557 519 { :controller => 'news', :action => 'index', :format => 'xml',
558 520 :project_id => '567' }
559 521 )
560 522 assert_routing(
561 523 { :method => 'get', :path => "/projects/567/news.json" },
562 524 { :controller => 'news', :action => 'index', :format => 'json',
563 525 :project_id => '567' }
564 526 )
565 527 assert_routing(
566 528 { :method => 'get', :path => "/news/2" },
567 529 { :controller => 'news', :action => 'show', :id => '2' }
568 530 )
569 531 assert_routing(
570 532 { :method => 'get', :path => "/projects/567/news/new" },
571 533 { :controller => 'news', :action => 'new', :project_id => '567' }
572 534 )
573 535 assert_routing(
574 536 { :method => 'get', :path => "/news/234" },
575 537 { :controller => 'news', :action => 'show', :id => '234' }
576 538 )
577 539 assert_routing(
578 540 { :method => 'get', :path => "/news/567/edit" },
579 541 { :controller => 'news', :action => 'edit', :id => '567' }
580 542 )
581 543 assert_routing(
582 544 { :method => 'get', :path => "/news/preview" },
583 545 { :controller => 'previews', :action => 'news' }
584 546 )
585 547 assert_routing(
586 548 { :method => 'post', :path => "/projects/567/news" },
587 549 { :controller => 'news', :action => 'create', :project_id => '567' }
588 550 )
589 551 assert_routing(
590 552 { :method => 'post', :path => "/news/567/comments" },
591 553 { :controller => 'comments', :action => 'create', :id => '567' }
592 554 )
593 555 assert_routing(
594 556 { :method => 'put', :path => "/news/567" },
595 557 { :controller => 'news', :action => 'update', :id => '567' }
596 558 )
597 559 assert_routing(
598 560 { :method => 'delete', :path => "/news/567" },
599 561 { :controller => 'news', :action => 'destroy', :id => '567' }
600 562 )
601 563 assert_routing(
602 564 { :method => 'delete', :path => "/news/567/comments/15" },
603 565 { :controller => 'comments', :action => 'destroy', :id => '567',
604 566 :comment_id => '15' }
605 567 )
606 568 end
607 569
608 570 def test_projects
609 571 assert_routing(
610 572 { :method => 'get', :path => "/projects" },
611 573 { :controller => 'projects', :action => 'index' }
612 574 )
613 575 assert_routing(
614 576 { :method => 'get', :path => "/projects.atom" },
615 577 { :controller => 'projects', :action => 'index', :format => 'atom' }
616 578 )
617 579 assert_routing(
618 580 { :method => 'get', :path => "/projects.xml" },
619 581 { :controller => 'projects', :action => 'index', :format => 'xml' }
620 582 )
621 583 assert_routing(
622 584 { :method => 'get', :path => "/projects/new" },
623 585 { :controller => 'projects', :action => 'new' }
624 586 )
625 587 assert_routing(
626 588 { :method => 'get', :path => "/projects/test" },
627 589 { :controller => 'projects', :action => 'show', :id => 'test' }
628 590 )
629 591 assert_routing(
630 592 { :method => 'get', :path => "/projects/1.xml" },
631 593 { :controller => 'projects', :action => 'show', :id => '1',
632 594 :format => 'xml' }
633 595 )
634 596 assert_routing(
635 597 { :method => 'get', :path => "/projects/4223/settings" },
636 598 { :controller => 'projects', :action => 'settings', :id => '4223' }
637 599 )
638 600 assert_routing(
639 601 { :method => 'get', :path => "/projects/4223/settings/members" },
640 602 { :controller => 'projects', :action => 'settings', :id => '4223',
641 603 :tab => 'members' }
642 604 )
643 605 assert_routing(
644 606 { :method => 'get', :path => "/projects/33/files" },
645 607 { :controller => 'files', :action => 'index', :project_id => '33' }
646 608 )
647 609 assert_routing(
648 610 { :method => 'get', :path => "/projects/33/files/new" },
649 611 { :controller => 'files', :action => 'new', :project_id => '33' }
650 612 )
651 613 assert_routing(
652 614 { :method => 'get', :path => "/projects/33/roadmap" },
653 615 { :controller => 'versions', :action => 'index', :project_id => '33' }
654 616 )
655 617 assert_routing(
656 618 { :method => 'get', :path => "/projects/33/activity" },
657 619 { :controller => 'activities', :action => 'index', :id => '33' }
658 620 )
659 621 assert_routing(
660 622 { :method => 'get', :path => "/projects/33/activity.atom" },
661 623 { :controller => 'activities', :action => 'index', :id => '33',
662 624 :format => 'atom' }
663 625 )
664 626 assert_routing(
665 627 { :method => 'post', :path => "/projects" },
666 628 { :controller => 'projects', :action => 'create' }
667 629 )
668 630 assert_routing(
669 631 { :method => 'post', :path => "/projects.xml" },
670 632 { :controller => 'projects', :action => 'create', :format => 'xml' }
671 633 )
672 634 assert_routing(
673 635 { :method => 'post', :path => "/projects/33/files" },
674 636 { :controller => 'files', :action => 'create', :project_id => '33' }
675 637 )
676 638 assert_routing(
677 639 { :method => 'post', :path => "/projects/64/archive" },
678 640 { :controller => 'projects', :action => 'archive', :id => '64' }
679 641 )
680 642 assert_routing(
681 643 { :method => 'post', :path => "/projects/64/unarchive" },
682 644 { :controller => 'projects', :action => 'unarchive', :id => '64' }
683 645 )
684 646 assert_routing(
685 647 { :method => 'put', :path => "/projects/64/enumerations" },
686 648 { :controller => 'project_enumerations', :action => 'update',
687 649 :project_id => '64' }
688 650 )
689 651 assert_routing(
690 652 { :method => 'put', :path => "/projects/4223" },
691 653 { :controller => 'projects', :action => 'update', :id => '4223' }
692 654 )
693 655 assert_routing(
694 656 { :method => 'put', :path => "/projects/1.xml" },
695 657 { :controller => 'projects', :action => 'update', :id => '1',
696 658 :format => 'xml' }
697 659 )
698 660 assert_routing(
699 661 { :method => 'delete', :path => "/projects/64" },
700 662 { :controller => 'projects', :action => 'destroy', :id => '64' }
701 663 )
702 664 assert_routing(
703 665 { :method => 'delete', :path => "/projects/1.xml" },
704 666 { :controller => 'projects', :action => 'destroy', :id => '1',
705 667 :format => 'xml' }
706 668 )
707 669 assert_routing(
708 670 { :method => 'delete', :path => "/projects/64/enumerations" },
709 671 { :controller => 'project_enumerations', :action => 'destroy',
710 672 :project_id => '64' }
711 673 )
712 674 end
713 675
714 676 def test_queries
715 677 assert_routing(
716 678 { :method => 'get', :path => "/queries.xml" },
717 679 { :controller => 'queries', :action => 'index', :format => 'xml' }
718 680 )
719 681 assert_routing(
720 682 { :method => 'get', :path => "/queries.json" },
721 683 { :controller => 'queries', :action => 'index', :format => 'json' }
722 684 )
723 685 assert_routing(
724 686 { :method => 'get', :path => "/queries/new" },
725 687 { :controller => 'queries', :action => 'new' }
726 688 )
727 689 assert_routing(
728 690 { :method => 'get', :path => "/projects/redmine/queries/new" },
729 691 { :controller => 'queries', :action => 'new', :project_id => 'redmine' }
730 692 )
731 693 assert_routing(
732 694 { :method => 'post', :path => "/queries" },
733 695 { :controller => 'queries', :action => 'create' }
734 696 )
735 697 assert_routing(
736 698 { :method => 'post', :path => "/projects/redmine/queries" },
737 699 { :controller => 'queries', :action => 'create', :project_id => 'redmine' }
738 700 )
739 701 assert_routing(
740 702 { :method => 'get', :path => "/queries/1/edit" },
741 703 { :controller => 'queries', :action => 'edit', :id => '1' }
742 704 )
743 705 assert_routing(
744 706 { :method => 'put', :path => "/queries/1" },
745 707 { :controller => 'queries', :action => 'update', :id => '1' }
746 708 )
747 709 assert_routing(
748 710 { :method => 'delete', :path => "/queries/1" },
749 711 { :controller => 'queries', :action => 'destroy', :id => '1' }
750 712 )
751 713 end
752 714
753 715 def test_repositories
754 716 assert_routing(
755 717 { :method => 'get',
756 718 :path => "/projects/redmine/repository" },
757 719 { :controller => 'repositories', :action => 'show', :id => 'redmine' }
758 720 )
759 721 assert_routing(
760 722 { :method => 'get',
761 723 :path => "/projects/redmine/repository/edit" },
762 724 { :controller => 'repositories', :action => 'edit', :id => 'redmine' }
763 725 )
764 726 assert_routing(
765 727 { :method => 'get',
766 728 :path => "/projects/redmine/repository/revisions" },
767 729 { :controller => 'repositories', :action => 'revisions', :id => 'redmine' }
768 730 )
769 731 assert_routing(
770 732 { :method => 'get',
771 733 :path => "/projects/redmine/repository/revisions.atom" },
772 734 { :controller => 'repositories', :action => 'revisions', :id => 'redmine',
773 735 :format => 'atom' }
774 736 )
775 737 assert_routing(
776 738 { :method => 'get',
777 739 :path => "/projects/redmine/repository/revisions/2457" },
778 740 { :controller => 'repositories', :action => 'revision', :id => 'redmine',
779 741 :rev => '2457' }
780 742 )
781 743 assert_routing(
782 744 { :method => 'get',
783 745 :path => "/projects/redmine/repository/revisions/2457/diff" },
784 746 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
785 747 :rev => '2457' }
786 748 )
787 749 assert_routing(
788 750 { :method => 'get',
789 751 :path => "/projects/redmine/repository/revisions/2457/diff.diff" },
790 752 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
791 753 :rev => '2457', :format => 'diff' }
792 754 )
793 755 assert_routing(
794 756 { :method => 'get',
795 757 :path => "/projects/redmine/repository/diff/path/to/file.c" },
796 758 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
797 759 :path => %w[path to file.c] }
798 760 )
799 761 assert_routing(
800 762 { :method => 'get',
801 763 :path => "/projects/redmine/repository/revisions/2/diff/path/to/file.c" },
802 764 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
803 765 :path => %w[path to file.c], :rev => '2' }
804 766 )
805 767 assert_routing(
806 768 { :method => 'get',
807 769 :path => "/projects/redmine/repository/browse/path/to/file.c" },
808 770 { :controller => 'repositories', :action => 'browse', :id => 'redmine',
809 771 :path => %w[path to file.c] }
810 772 )
811 773 assert_routing(
812 774 { :method => 'get',
813 775 :path => "/projects/redmine/repository/entry/path/to/file.c" },
814 776 { :controller => 'repositories', :action => 'entry', :id => 'redmine',
815 777 :path => %w[path to file.c] }
816 778 )
817 779 assert_routing(
818 780 { :method => 'get',
819 781 :path => "/projects/redmine/repository/revisions/2/entry/path/to/file.c" },
820 782 { :controller => 'repositories', :action => 'entry', :id => 'redmine',
821 783 :path => %w[path to file.c], :rev => '2' }
822 784 )
823 785 assert_routing(
824 786 { :method => 'get',
825 787 :path => "/projects/redmine/repository/raw/path/to/file.c" },
826 788 { :controller => 'repositories', :action => 'entry', :id => 'redmine',
827 789 :path => %w[path to file.c], :format => 'raw' }
828 790 )
829 791 assert_routing(
830 792 { :method => 'get',
831 793 :path => "/projects/redmine/repository/revisions/2/raw/path/to/file.c" },
832 794 { :controller => 'repositories', :action => 'entry', :id => 'redmine',
833 795 :path => %w[path to file.c], :rev => '2', :format => 'raw' }
834 796 )
835 797 assert_routing(
836 798 { :method => 'get',
837 799 :path => "/projects/redmine/repository/annotate/path/to/file.c" },
838 800 { :controller => 'repositories', :action => 'annotate', :id => 'redmine',
839 801 :path => %w[path to file.c] }
840 802 )
841 803 assert_routing(
842 804 { :method => 'get',
843 805 :path => "/projects/redmine/repository/changes/path/to/file.c" },
844 806 { :controller => 'repositories', :action => 'changes', :id => 'redmine',
845 807 :path => %w[path to file.c] }
846 808 )
847 809 assert_routing(
848 810 { :method => 'get',
849 811 :path => "/projects/redmine/repository/statistics" },
850 812 { :controller => 'repositories', :action => 'stats', :id => 'redmine' }
851 813 )
852 814 assert_routing(
853 815 { :method => 'post',
854 816 :path => "/projects/redmine/repository/edit" },
855 817 { :controller => 'repositories', :action => 'edit', :id => 'redmine' }
856 818 )
857 819 end
858 820
859 821 def test_roles
860 822 assert_routing(
861 823 { :method => 'get', :path => "/roles" },
862 824 { :controller => 'roles', :action => 'index' }
863 825 )
864 826 assert_routing(
865 827 { :method => 'get', :path => "/roles/new" },
866 828 { :controller => 'roles', :action => 'new' }
867 829 )
868 830 assert_routing(
869 831 { :method => 'post', :path => "/roles" },
870 832 { :controller => 'roles', :action => 'create' }
871 833 )
872 834 assert_routing(
873 835 { :method => 'get', :path => "/roles/2/edit" },
874 836 { :controller => 'roles', :action => 'edit', :id => '2' }
875 837 )
876 838 assert_routing(
877 839 { :method => 'put', :path => "/roles/2" },
878 840 { :controller => 'roles', :action => 'update', :id => '2' }
879 841 )
880 842 assert_routing(
881 843 { :method => 'delete', :path => "/roles/2" },
882 844 { :controller => 'roles', :action => 'destroy', :id => '2' }
883 845 )
884 846 assert_routing(
885 847 { :method => 'get', :path => "/roles/permissions" },
886 848 { :controller => 'roles', :action => 'permissions' }
887 849 )
888 850 assert_routing(
889 851 { :method => 'post', :path => "/roles/permissions" },
890 852 { :controller => 'roles', :action => 'permissions' }
891 853 )
892 854 end
893 855
894 856 def test_timelogs_global
895 857 assert_routing(
896 858 { :method => 'get', :path => "/time_entries" },
897 859 { :controller => 'timelog', :action => 'index' }
898 860 )
899 861 assert_routing(
900 862 { :method => 'get', :path => "/time_entries.csv" },
901 863 { :controller => 'timelog', :action => 'index', :format => 'csv' }
902 864 )
903 865 assert_routing(
904 866 { :method => 'get', :path => "/time_entries.atom" },
905 867 { :controller => 'timelog', :action => 'index', :format => 'atom' }
906 868 )
907 869 assert_routing(
908 870 { :method => 'get', :path => "/time_entries/new" },
909 871 { :controller => 'timelog', :action => 'new' }
910 872 )
911 873 assert_routing(
912 874 { :method => 'get', :path => "/time_entries/22/edit" },
913 875 { :controller => 'timelog', :action => 'edit', :id => '22' }
914 876 )
915 877 assert_routing(
916 878 { :method => 'post', :path => "/time_entries" },
917 879 { :controller => 'timelog', :action => 'create' }
918 880 )
919 881 assert_routing(
920 882 { :method => 'put', :path => "/time_entries/22" },
921 883 { :controller => 'timelog', :action => 'update', :id => '22' }
922 884 )
923 885 assert_routing(
924 886 { :method => 'delete', :path => "/time_entries/55" },
925 887 { :controller => 'timelog', :action => 'destroy', :id => '55' }
926 888 )
927 889 end
928 890
929 891 def test_timelogs_scoped_under_project
930 892 assert_routing(
931 893 { :method => 'get', :path => "/projects/567/time_entries" },
932 894 { :controller => 'timelog', :action => 'index', :project_id => '567' }
933 895 )
934 896 assert_routing(
935 897 { :method => 'get', :path => "/projects/567/time_entries.csv" },
936 898 { :controller => 'timelog', :action => 'index', :project_id => '567',
937 899 :format => 'csv' }
938 900 )
939 901 assert_routing(
940 902 { :method => 'get', :path => "/projects/567/time_entries.atom" },
941 903 { :controller => 'timelog', :action => 'index', :project_id => '567',
942 904 :format => 'atom' }
943 905 )
944 906 assert_routing(
945 907 { :method => 'get', :path => "/projects/567/time_entries/new" },
946 908 { :controller => 'timelog', :action => 'new', :project_id => '567' }
947 909 )
948 910 assert_routing(
949 911 { :method => 'get', :path => "/projects/567/time_entries/22/edit" },
950 912 { :controller => 'timelog', :action => 'edit',
951 913 :id => '22', :project_id => '567' }
952 914 )
953 915 assert_routing(
954 916 { :method => 'post', :path => "/projects/567/time_entries" },
955 917 { :controller => 'timelog', :action => 'create',
956 918 :project_id => '567' }
957 919 )
958 920 assert_routing(
959 921 { :method => 'put', :path => "/projects/567/time_entries/22" },
960 922 { :controller => 'timelog', :action => 'update',
961 923 :id => '22', :project_id => '567' }
962 924 )
963 925 assert_routing(
964 926 { :method => 'delete', :path => "/projects/567/time_entries/55" },
965 927 { :controller => 'timelog', :action => 'destroy',
966 928 :id => '55', :project_id => '567' }
967 929 )
968 930 end
969 931
970 932 def test_timelogs_scoped_under_issues
971 933 assert_routing(
972 934 { :method => 'get', :path => "/issues/234/time_entries" },
973 935 { :controller => 'timelog', :action => 'index', :issue_id => '234' }
974 936 )
975 937 assert_routing(
976 938 { :method => 'get', :path => "/issues/234/time_entries.csv" },
977 939 { :controller => 'timelog', :action => 'index', :issue_id => '234',
978 940 :format => 'csv' }
979 941 )
980 942 assert_routing(
981 943 { :method => 'get', :path => "/issues/234/time_entries.atom" },
982 944 { :controller => 'timelog', :action => 'index', :issue_id => '234',
983 945 :format => 'atom' }
984 946 )
985 947 assert_routing(
986 948 { :method => 'get', :path => "/issues/234/time_entries/new" },
987 949 { :controller => 'timelog', :action => 'new', :issue_id => '234' }
988 950 )
989 951 assert_routing(
990 952 { :method => 'get', :path => "/issues/234/time_entries/22/edit" },
991 953 { :controller => 'timelog', :action => 'edit', :id => '22',
992 954 :issue_id => '234' }
993 955 )
994 956 assert_routing(
995 957 { :method => 'post', :path => "/issues/234/time_entries" },
996 958 { :controller => 'timelog', :action => 'create', :issue_id => '234' }
997 959 )
998 960 assert_routing(
999 961 { :method => 'put', :path => "/issues/234/time_entries/22" },
1000 962 { :controller => 'timelog', :action => 'update', :id => '22',
1001 963 :issue_id => '234' }
1002 964 )
1003 965 assert_routing(
1004 966 { :method => 'delete', :path => "/issues/234/time_entries/55" },
1005 967 { :controller => 'timelog', :action => 'destroy', :id => '55',
1006 968 :issue_id => '234' }
1007 969 )
1008 970 end
1009 971
1010 972 def test_timelogs_scoped_under_project_and_issues
1011 973 assert_routing(
1012 974 { :method => 'get',
1013 975 :path => "/projects/ecookbook/issues/234/time_entries" },
1014 976 { :controller => 'timelog', :action => 'index',
1015 977 :issue_id => '234', :project_id => 'ecookbook' }
1016 978 )
1017 979 assert_routing(
1018 980 { :method => 'get',
1019 981 :path => "/projects/ecookbook/issues/234/time_entries.csv" },
1020 982 { :controller => 'timelog', :action => 'index',
1021 983 :issue_id => '234', :project_id => 'ecookbook', :format => 'csv' }
1022 984 )
1023 985 assert_routing(
1024 986 { :method => 'get',
1025 987 :path => "/projects/ecookbook/issues/234/time_entries.atom" },
1026 988 { :controller => 'timelog', :action => 'index',
1027 989 :issue_id => '234', :project_id => 'ecookbook', :format => 'atom' }
1028 990 )
1029 991 assert_routing(
1030 992 { :method => 'get',
1031 993 :path => "/projects/ecookbook/issues/234/time_entries/new" },
1032 994 { :controller => 'timelog', :action => 'new',
1033 995 :issue_id => '234', :project_id => 'ecookbook' }
1034 996 )
1035 997 assert_routing(
1036 998 { :method => 'get',
1037 999 :path => "/projects/ecookbook/issues/234/time_entries/22/edit" },
1038 1000 { :controller => 'timelog', :action => 'edit', :id => '22',
1039 1001 :issue_id => '234', :project_id => 'ecookbook' }
1040 1002 )
1041 1003 assert_routing(
1042 1004 { :method => 'post',
1043 1005 :path => "/projects/ecookbook/issues/234/time_entries" },
1044 1006 { :controller => 'timelog', :action => 'create',
1045 1007 :issue_id => '234', :project_id => 'ecookbook' }
1046 1008 )
1047 1009 assert_routing(
1048 1010 { :method => 'put',
1049 1011 :path => "/projects/ecookbook/issues/234/time_entries/22" },
1050 1012 { :controller => 'timelog', :action => 'update', :id => '22',
1051 1013 :issue_id => '234', :project_id => 'ecookbook' }
1052 1014 )
1053 1015 assert_routing(
1054 1016 { :method => 'delete',
1055 1017 :path => "/projects/ecookbook/issues/234/time_entries/55" },
1056 1018 { :controller => 'timelog', :action => 'destroy', :id => '55',
1057 1019 :issue_id => '234', :project_id => 'ecookbook' }
1058 1020 )
1059 1021 assert_routing(
1060 1022 { :method => 'get',
1061 1023 :path => "/time_entries/report" },
1062 1024 { :controller => 'timelog', :action => 'report' }
1063 1025 )
1064 1026 assert_routing(
1065 1027 { :method => 'get',
1066 1028 :path => "/projects/567/time_entries/report" },
1067 1029 { :controller => 'timelog', :action => 'report', :project_id => '567' }
1068 1030 )
1069 1031 assert_routing(
1070 1032 { :method => 'get',
1071 1033 :path => "/projects/567/time_entries/report.csv" },
1072 1034 { :controller => 'timelog', :action => 'report', :project_id => '567',
1073 1035 :format => 'csv' }
1074 1036 )
1075 1037 end
1076 1038
1077 1039 def test_users
1078 1040 assert_routing(
1079 1041 { :method => 'get', :path => "/users" },
1080 1042 { :controller => 'users', :action => 'index' }
1081 1043 )
1082 1044 assert_routing(
1083 1045 { :method => 'get', :path => "/users.xml" },
1084 1046 { :controller => 'users', :action => 'index', :format => 'xml' }
1085 1047 )
1086 1048 assert_routing(
1087 1049 { :method => 'get', :path => "/users/44" },
1088 1050 { :controller => 'users', :action => 'show', :id => '44' }
1089 1051 )
1090 1052 assert_routing(
1091 1053 { :method => 'get', :path => "/users/44.xml" },
1092 1054 { :controller => 'users', :action => 'show', :id => '44',
1093 1055 :format => 'xml' }
1094 1056 )
1095 1057 assert_routing(
1096 1058 { :method => 'get', :path => "/users/current" },
1097 1059 { :controller => 'users', :action => 'show', :id => 'current' }
1098 1060 )
1099 1061 assert_routing(
1100 1062 { :method => 'get', :path => "/users/current.xml" },
1101 1063 { :controller => 'users', :action => 'show', :id => 'current',
1102 1064 :format => 'xml' }
1103 1065 )
1104 1066 assert_routing(
1105 1067 { :method => 'get', :path => "/users/new" },
1106 1068 { :controller => 'users', :action => 'new' }
1107 1069 )
1108 1070 assert_routing(
1109 1071 { :method => 'get', :path => "/users/444/edit" },
1110 1072 { :controller => 'users', :action => 'edit', :id => '444' }
1111 1073 )
1112 1074 assert_routing(
1113 1075 { :method => 'post', :path => "/users" },
1114 1076 { :controller => 'users', :action => 'create' }
1115 1077 )
1116 1078 assert_routing(
1117 1079 { :method => 'post', :path => "/users.xml" },
1118 1080 { :controller => 'users', :action => 'create', :format => 'xml' }
1119 1081 )
1120 1082 assert_routing(
1121 1083 { :method => 'put', :path => "/users/444" },
1122 1084 { :controller => 'users', :action => 'update', :id => '444' }
1123 1085 )
1124 1086 assert_routing(
1125 1087 { :method => 'put', :path => "/users/444.xml" },
1126 1088 { :controller => 'users', :action => 'update', :id => '444',
1127 1089 :format => 'xml' }
1128 1090 )
1129 1091 assert_routing(
1130 1092 { :method => 'delete', :path => "/users/44" },
1131 1093 { :controller => 'users', :action => 'destroy', :id => '44' }
1132 1094 )
1133 1095 assert_routing(
1134 1096 { :method => 'delete', :path => "/users/44.xml" },
1135 1097 { :controller => 'users', :action => 'destroy', :id => '44',
1136 1098 :format => 'xml' }
1137 1099 )
1138 1100 assert_routing(
1139 1101 { :method => 'post', :path => "/users/123/memberships" },
1140 1102 { :controller => 'users', :action => 'edit_membership',
1141 1103 :id => '123' }
1142 1104 )
1143 1105 assert_routing(
1144 1106 { :method => 'put', :path => "/users/123/memberships/55" },
1145 1107 { :controller => 'users', :action => 'edit_membership',
1146 1108 :id => '123', :membership_id => '55' }
1147 1109 )
1148 1110 assert_routing(
1149 1111 { :method => 'delete', :path => "/users/123/memberships/55" },
1150 1112 { :controller => 'users', :action => 'destroy_membership',
1151 1113 :id => '123', :membership_id => '55' }
1152 1114 )
1153 1115 end
1154 1116
1155 1117 def test_versions
1156 1118 # /projects/foo/versions is /projects/foo/roadmap
1157 1119 assert_routing(
1158 1120 { :method => 'get', :path => "/projects/foo/versions.xml" },
1159 1121 { :controller => 'versions', :action => 'index',
1160 1122 :project_id => 'foo', :format => 'xml' }
1161 1123 )
1162 1124 assert_routing(
1163 1125 { :method => 'get', :path => "/projects/foo/versions.json" },
1164 1126 { :controller => 'versions', :action => 'index',
1165 1127 :project_id => 'foo', :format => 'json' }
1166 1128 )
1167 1129 assert_routing(
1168 1130 { :method => 'get', :path => "/projects/foo/versions/new" },
1169 1131 { :controller => 'versions', :action => 'new',
1170 1132 :project_id => 'foo' }
1171 1133 )
1172 1134 assert_routing(
1173 1135 { :method => 'post', :path => "/projects/foo/versions" },
1174 1136 { :controller => 'versions', :action => 'create',
1175 1137 :project_id => 'foo' }
1176 1138 )
1177 1139 assert_routing(
1178 1140 { :method => 'post', :path => "/projects/foo/versions.xml" },
1179 1141 { :controller => 'versions', :action => 'create',
1180 1142 :project_id => 'foo', :format => 'xml' }
1181 1143 )
1182 1144 assert_routing(
1183 1145 { :method => 'post', :path => "/projects/foo/versions.json" },
1184 1146 { :controller => 'versions', :action => 'create',
1185 1147 :project_id => 'foo', :format => 'json' }
1186 1148 )
1187 1149 assert_routing(
1188 1150 { :method => 'get', :path => "/versions/1" },
1189 1151 { :controller => 'versions', :action => 'show', :id => '1' }
1190 1152 )
1191 1153 assert_routing(
1192 1154 { :method => 'get', :path => "/versions/1.xml" },
1193 1155 { :controller => 'versions', :action => 'show', :id => '1',
1194 1156 :format => 'xml' }
1195 1157 )
1196 1158 assert_routing(
1197 1159 { :method => 'get', :path => "/versions/1.json" },
1198 1160 { :controller => 'versions', :action => 'show', :id => '1',
1199 1161 :format => 'json' }
1200 1162 )
1201 1163 assert_routing(
1202 1164 { :method => 'get', :path => "/versions/1/edit" },
1203 1165 { :controller => 'versions', :action => 'edit', :id => '1' }
1204 1166 )
1205 1167 assert_routing(
1206 1168 { :method => 'put', :path => "/versions/1" },
1207 1169 { :controller => 'versions', :action => 'update', :id => '1' }
1208 1170 )
1209 1171 assert_routing(
1210 1172 { :method => 'put', :path => "/versions/1.xml" },
1211 1173 { :controller => 'versions', :action => 'update', :id => '1',
1212 1174 :format => 'xml' }
1213 1175 )
1214 1176 assert_routing(
1215 1177 { :method => 'put', :path => "/versions/1.json" },
1216 1178 { :controller => 'versions', :action => 'update', :id => '1',
1217 1179 :format => 'json' }
1218 1180 )
1219 1181 assert_routing(
1220 1182 { :method => 'delete', :path => "/versions/1" },
1221 1183 { :controller => 'versions', :action => 'destroy', :id => '1' }
1222 1184 )
1223 1185 assert_routing(
1224 1186 { :method => 'delete', :path => "/versions/1.xml" },
1225 1187 { :controller => 'versions', :action => 'destroy', :id => '1',
1226 1188 :format => 'xml' }
1227 1189 )
1228 1190 assert_routing(
1229 1191 { :method => 'delete', :path => "/versions/1.json" },
1230 1192 { :controller => 'versions', :action => 'destroy', :id => '1',
1231 1193 :format => 'json' }
1232 1194 )
1233 1195 assert_routing(
1234 1196 { :method => 'put', :path => "/projects/foo/versions/close_completed" },
1235 1197 { :controller => 'versions', :action => 'close_completed',
1236 1198 :project_id => 'foo' }
1237 1199 )
1238 1200 assert_routing(
1239 1201 { :method => 'post', :path => "/versions/1/status_by" },
1240 1202 { :controller => 'versions', :action => 'status_by', :id => '1' }
1241 1203 )
1242 1204 end
1243 1205
1244 1206 def test_welcome
1245 1207 assert_routing(
1246 1208 { :method => 'get', :path => "/robots.txt" },
1247 1209 { :controller => 'welcome', :action => 'robots' }
1248 1210 )
1249 1211 end
1250 1212
1251 1213 def test_wiki_singular_projects_pages
1252 1214 assert_routing(
1253 1215 { :method => 'get', :path => "/projects/567/wiki" },
1254 1216 { :controller => 'wiki', :action => 'show', :project_id => '567' }
1255 1217 )
1256 1218 assert_routing(
1257 1219 { :method => 'get', :path => "/projects/567/wiki/lalala" },
1258 1220 { :controller => 'wiki', :action => 'show', :project_id => '567',
1259 1221 :id => 'lalala' }
1260 1222 )
1261 1223 assert_routing(
1262 1224 { :method => 'get', :path => "/projects/567/wiki/my_page/edit" },
1263 1225 { :controller => 'wiki', :action => 'edit', :project_id => '567',
1264 1226 :id => 'my_page' }
1265 1227 )
1266 1228 assert_routing(
1267 1229 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/history" },
1268 1230 { :controller => 'wiki', :action => 'history', :project_id => '1',
1269 1231 :id => 'CookBook_documentation' }
1270 1232 )
1271 1233 assert_routing(
1272 1234 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff" },
1273 1235 { :controller => 'wiki', :action => 'diff', :project_id => '1',
1274 1236 :id => 'CookBook_documentation' }
1275 1237 )
1276 1238 assert_routing(
1277 1239 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2" },
1278 1240 { :controller => 'wiki', :action => 'diff', :project_id => '1',
1279 1241 :id => 'CookBook_documentation', :version => '2' }
1280 1242 )
1281 1243 assert_routing(
1282 1244 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2/vs/1" },
1283 1245 { :controller => 'wiki', :action => 'diff', :project_id => '1',
1284 1246 :id => 'CookBook_documentation', :version => '2', :version_from => '1' }
1285 1247 )
1286 1248 assert_routing(
1287 1249 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/annotate/2" },
1288 1250 { :controller => 'wiki', :action => 'annotate', :project_id => '1',
1289 1251 :id => 'CookBook_documentation', :version => '2' }
1290 1252 )
1291 1253 assert_routing(
1292 1254 { :method => 'get', :path => "/projects/22/wiki/ladida/rename" },
1293 1255 { :controller => 'wiki', :action => 'rename', :project_id => '22',
1294 1256 :id => 'ladida' }
1295 1257 )
1296 1258 assert_routing(
1297 1259 { :method => 'get', :path => "/projects/567/wiki/index" },
1298 1260 { :controller => 'wiki', :action => 'index', :project_id => '567' }
1299 1261 )
1300 1262 assert_routing(
1301 1263 { :method => 'get', :path => "/projects/567/wiki/date_index" },
1302 1264 { :controller => 'wiki', :action => 'date_index', :project_id => '567' }
1303 1265 )
1304 1266 assert_routing(
1305 1267 { :method => 'get', :path => "/projects/567/wiki/export" },
1306 1268 { :controller => 'wiki', :action => 'export', :project_id => '567' }
1307 1269 )
1308 1270 assert_routing(
1309 1271 { :method => 'post', :path => "/projects/567/wiki/CookBook_documentation/preview" },
1310 1272 { :controller => 'wiki', :action => 'preview', :project_id => '567',
1311 1273 :id => 'CookBook_documentation' }
1312 1274 )
1313 1275 assert_routing(
1314 1276 { :method => 'post', :path => "/projects/22/wiki/ladida/rename" },
1315 1277 { :controller => 'wiki', :action => 'rename', :project_id => '22',
1316 1278 :id => 'ladida' }
1317 1279 )
1318 1280 assert_routing(
1319 1281 { :method => 'post', :path => "/projects/22/wiki/ladida/protect" },
1320 1282 { :controller => 'wiki', :action => 'protect', :project_id => '22',
1321 1283 :id => 'ladida' }
1322 1284 )
1323 1285 assert_routing(
1324 1286 { :method => 'post', :path => "/projects/22/wiki/ladida/add_attachment" },
1325 1287 { :controller => 'wiki', :action => 'add_attachment', :project_id => '22',
1326 1288 :id => 'ladida' }
1327 1289 )
1328 1290 assert_routing(
1329 1291 { :method => 'put', :path => "/projects/567/wiki/my_page" },
1330 1292 { :controller => 'wiki', :action => 'update', :project_id => '567',
1331 1293 :id => 'my_page' }
1332 1294 )
1333 1295 assert_routing(
1334 1296 { :method => 'delete', :path => "/projects/22/wiki/ladida" },
1335 1297 { :controller => 'wiki', :action => 'destroy', :project_id => '22',
1336 1298 :id => 'ladida' }
1337 1299 )
1338 1300 end
1339 1301
1340 1302 def test_wikis_plural_admin_setup
1341 1303 assert_routing(
1342 1304 { :method => 'get', :path => "/projects/ladida/wiki/destroy" },
1343 1305 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
1344 1306 )
1345 1307 assert_routing(
1346 1308 { :method => 'post', :path => "/projects/ladida/wiki" },
1347 1309 { :controller => 'wikis', :action => 'edit', :id => 'ladida' }
1348 1310 )
1349 1311 assert_routing(
1350 1312 { :method => 'post', :path => "/projects/ladida/wiki/destroy" },
1351 1313 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
1352 1314 )
1353 1315 end
1354 1316 end
General Comments 0
You need to be logged in to leave comments. Login now