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