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