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