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