##// END OF EJS Templates
test: route: move gantts test in test_issues_extra_actions to new file...
Toshi MARUYAMA -
r8221:ed933a28da5e
parent child
Show More
@@ -0,0 +1,41
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 RoutingGanttsTest < ActionController::IntegrationTest
21 def test_gantts
22 assert_routing(
23 { :method => 'get', :path => "/issues/gantt" },
24 { :controller => 'gantts', :action => 'show' }
25 )
26 assert_routing(
27 { :method => 'get', :path => "/issues/gantt.pdf" },
28 { :controller => 'gantts', :action => 'show', :format => 'pdf' }
29 )
30 assert_routing(
31 { :method => 'get', :path => "/projects/project-name/issues/gantt" },
32 { :controller => 'gantts', :action => 'show',
33 :project_id => 'project-name' }
34 )
35 assert_routing(
36 { :method => 'get', :path => "/projects/project-name/issues/gantt.pdf" },
37 { :controller => 'gantts', :action => 'show',
38 :project_id => 'project-name', :format => 'pdf' }
39 )
40 end
41 end
@@ -1,874 +1,856
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2011 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 require File.expand_path('../../test_helper', __FILE__)
19 19
20 20 class RoutingTest < ActionController::IntegrationTest
21 21 def test_issues_rest_actions
22 22 assert_routing(
23 23 { :method => 'get', :path => "/issues" },
24 24 { :controller => 'issues', :action => 'index' }
25 25 )
26 26 assert_routing(
27 27 { :method => 'get', :path => "/issues.pdf" },
28 28 { :controller => 'issues', :action => 'index', :format => 'pdf' }
29 29 )
30 30 assert_routing(
31 31 { :method => 'get', :path => "/issues.atom" },
32 32 { :controller => 'issues', :action => 'index', :format => 'atom' }
33 33 )
34 34 assert_routing(
35 35 { :method => 'get', :path => "/issues.xml" },
36 36 { :controller => 'issues', :action => 'index', :format => 'xml' }
37 37 )
38 38 assert_routing(
39 39 { :method => 'get', :path => "/projects/23/issues" },
40 40 { :controller => 'issues', :action => 'index', :project_id => '23' }
41 41 )
42 42 assert_routing(
43 43 { :method => 'get', :path => "/projects/23/issues.pdf" },
44 44 { :controller => 'issues', :action => 'index', :project_id => '23',
45 45 :format => 'pdf' }
46 46 )
47 47 assert_routing(
48 48 { :method => 'get', :path => "/projects/23/issues.atom" },
49 49 { :controller => 'issues', :action => 'index', :project_id => '23',
50 50 :format => 'atom' }
51 51 )
52 52 assert_routing(
53 53 { :method => 'get', :path => "/projects/23/issues.xml" },
54 54 { :controller => 'issues', :action => 'index', :project_id => '23',
55 55 :format => 'xml' }
56 56 )
57 57 assert_routing(
58 58 { :method => 'get', :path => "/issues/64" },
59 59 { :controller => 'issues', :action => 'show', :id => '64' }
60 60 )
61 61 assert_routing(
62 62 { :method => 'get', :path => "/issues/64.pdf" },
63 63 { :controller => 'issues', :action => 'show', :id => '64',
64 64 :format => 'pdf' }
65 65 )
66 66 assert_routing(
67 67 { :method => 'get', :path => "/issues/64.atom" },
68 68 { :controller => 'issues', :action => 'show', :id => '64',
69 69 :format => 'atom' }
70 70 )
71 71 assert_routing(
72 72 { :method => 'get', :path => "/issues/64.xml" },
73 73 { :controller => 'issues', :action => 'show', :id => '64',
74 74 :format => 'xml' }
75 75 )
76 76 assert_routing(
77 77 { :method => 'get', :path => "/projects/23/issues/new" },
78 78 { :controller => 'issues', :action => 'new', :project_id => '23' }
79 79 )
80 80 end
81 81
82 82 def test_issues_form_update
83 83 assert_routing(
84 84 { :method => 'post', :path => "/projects/23/issues/new" },
85 85 { :controller => 'issues', :action => 'new', :project_id => '23' }
86 86 )
87 87 assert_routing(
88 88 { :method => 'post', :path => "/projects/23/issues" },
89 89 { :controller => 'issues', :action => 'create', :project_id => '23' }
90 90 )
91 91 assert_routing(
92 92 { :method => 'post', :path => "/issues.xml" },
93 93 { :controller => 'issues', :action => 'create', :format => 'xml' }
94 94 )
95 95 assert_routing(
96 96 { :method => 'get', :path => "/issues/64/edit" },
97 97 { :controller => 'issues', :action => 'edit', :id => '64' }
98 98 )
99 99 assert_routing(
100 100 { :method => 'put', :path => "/issues/1.xml" },
101 101 { :controller => 'issues', :action => 'update', :id => '1',
102 102 :format => 'xml' }
103 103 )
104 104 assert_routing(
105 105 { :method => 'delete', :path => "/issues/1.xml" },
106 106 { :controller => 'issues', :action => 'destroy', :id => '1',
107 107 :format => 'xml' }
108 108 )
109 109 end
110 110
111 111 def test_issues_extra_actions
112 112 assert_routing(
113 113 { :method => 'get', :path => "/projects/23/issues/64/copy" },
114 114 { :controller => 'issues', :action => 'new', :project_id => '23',
115 115 :copy_from => '64' }
116 116 )
117 117 assert_routing(
118 { :method => 'get', :path => "/issues/gantt" },
119 { :controller => 'gantts', :action => 'show' }
120 )
121 assert_routing(
122 { :method => 'get', :path => "/issues/gantt.pdf" },
123 { :controller => 'gantts', :action => 'show', :format => 'pdf' }
124 )
125 assert_routing(
126 { :method => 'get', :path => "/projects/project-name/issues/gantt" },
127 { :controller => 'gantts', :action => 'show',
128 :project_id => 'project-name' }
129 )
130 assert_routing(
131 { :method => 'get', :path => "/projects/project-name/issues/gantt.pdf" },
132 { :controller => 'gantts', :action => 'show',
133 :project_id => 'project-name', :format => 'pdf' }
134 )
135 assert_routing(
136 118 { :method => 'get', :path => "/issues/auto_complete" },
137 119 { :controller => 'auto_completes', :action => 'issues' }
138 120 )
139 121 assert_routing(
140 122 { :method => 'get', :path => "/issues/preview/123" },
141 123 { :controller => 'previews', :action => 'issue', :id => '123' }
142 124 )
143 125 assert_routing(
144 126 { :method => 'post', :path => "/issues/preview/123" },
145 127 { :controller => 'previews', :action => 'issue', :id => '123' }
146 128 )
147 129 assert_routing(
148 130 { :method => 'get', :path => "/issues/context_menu" },
149 131 { :controller => 'context_menus', :action => 'issues' }
150 132 )
151 133 assert_routing(
152 134 { :method => 'post', :path => "/issues/context_menu" },
153 135 { :controller => 'context_menus', :action => 'issues' }
154 136 )
155 137 assert_routing(
156 138 { :method => 'get', :path => "/issues/bulk_edit" },
157 139 { :controller => 'issues', :action => 'bulk_edit' }
158 140 )
159 141 assert_routing(
160 142 { :method => 'post', :path => "/issues/bulk_update" },
161 143 { :controller => 'issues', :action => 'bulk_update' }
162 144 )
163 145 end
164 146
165 147 def test_issue_categories
166 148 assert_routing(
167 149 { :method => 'get', :path => "/projects/foo/issue_categories" },
168 150 { :controller => 'issue_categories', :action => 'index',
169 151 :project_id => 'foo' }
170 152 )
171 153 assert_routing(
172 154 { :method => 'get', :path => "/projects/foo/issue_categories.xml" },
173 155 { :controller => 'issue_categories', :action => 'index',
174 156 :project_id => 'foo', :format => 'xml' }
175 157 )
176 158 assert_routing(
177 159 { :method => 'get', :path => "/projects/foo/issue_categories.json" },
178 160 { :controller => 'issue_categories', :action => 'index',
179 161 :project_id => 'foo', :format => 'json' }
180 162 )
181 163 assert_routing(
182 164 { :method => 'get', :path => "/projects/foo/issue_categories/new" },
183 165 { :controller => 'issue_categories', :action => 'new',
184 166 :project_id => 'foo' }
185 167 )
186 168 assert_routing(
187 169 { :method => 'post', :path => "/projects/foo/issue_categories" },
188 170 { :controller => 'issue_categories', :action => 'create',
189 171 :project_id => 'foo' }
190 172 )
191 173 assert_routing(
192 174 { :method => 'post', :path => "/projects/foo/issue_categories.xml" },
193 175 { :controller => 'issue_categories', :action => 'create',
194 176 :project_id => 'foo', :format => 'xml' }
195 177 )
196 178 assert_routing(
197 179 { :method => 'post', :path => "/projects/foo/issue_categories.json" },
198 180 { :controller => 'issue_categories', :action => 'create',
199 181 :project_id => 'foo', :format => 'json' }
200 182 )
201 183 assert_routing(
202 184 { :method => 'get', :path => "/issue_categories/1" },
203 185 { :controller => 'issue_categories', :action => 'show', :id => '1' }
204 186 )
205 187 assert_routing(
206 188 { :method => 'get', :path => "/issue_categories/1.xml" },
207 189 { :controller => 'issue_categories', :action => 'show', :id => '1',
208 190 :format => 'xml' }
209 191 )
210 192 assert_routing(
211 193 { :method => 'get', :path => "/issue_categories/1.json" },
212 194 { :controller => 'issue_categories', :action => 'show', :id => '1',
213 195 :format => 'json' }
214 196 )
215 197 assert_routing(
216 198 { :method => 'get', :path => "/issue_categories/1/edit" },
217 199 { :controller => 'issue_categories', :action => 'edit', :id => '1' }
218 200 )
219 201 assert_routing(
220 202 { :method => 'put', :path => "/issue_categories/1" },
221 203 { :controller => 'issue_categories', :action => 'update', :id => '1' }
222 204 )
223 205 assert_routing(
224 206 { :method => 'put', :path => "/issue_categories/1.xml" },
225 207 { :controller => 'issue_categories', :action => 'update', :id => '1',
226 208 :format => 'xml' }
227 209 )
228 210 assert_routing(
229 211 { :method => 'put', :path => "/issue_categories/1.json" },
230 212 { :controller => 'issue_categories', :action => 'update', :id => '1',
231 213 :format => 'json' }
232 214 )
233 215 assert_routing(
234 216 { :method => 'delete', :path => "/issue_categories/1" },
235 217 { :controller => 'issue_categories', :action => 'destroy', :id => '1' }
236 218 )
237 219 assert_routing(
238 220 { :method => 'delete', :path => "/issue_categories/1.xml" },
239 221 { :controller => 'issue_categories', :action => 'destroy', :id => '1',
240 222 :format => 'xml' }
241 223 )
242 224 assert_routing(
243 225 { :method => 'delete', :path => "/issue_categories/1.json" },
244 226 { :controller => 'issue_categories', :action => 'destroy', :id => '1',
245 227 :format => 'json' }
246 228 )
247 229 end
248 230
249 231 def test_members
250 232 assert_routing(
251 233 { :method => 'post', :path => "/projects/5234/members/new" },
252 234 { :controller => 'members', :action => 'new', :id => '5234' }
253 235 )
254 236 end
255 237
256 238 def test_news
257 239 assert_routing(
258 240 { :method => 'get', :path => "/news" },
259 241 { :controller => 'news', :action => 'index' }
260 242 )
261 243 assert_routing(
262 244 { :method => 'get', :path => "/news.atom" },
263 245 { :controller => 'news', :action => 'index', :format => 'atom' }
264 246 )
265 247 assert_routing(
266 248 { :method => 'get', :path => "/news.xml" },
267 249 { :controller => 'news', :action => 'index', :format => 'xml' }
268 250 )
269 251 assert_routing(
270 252 { :method => 'get', :path => "/news.json" },
271 253 { :controller => 'news', :action => 'index', :format => 'json' }
272 254 )
273 255 assert_routing(
274 256 { :method => 'get', :path => "/projects/567/news" },
275 257 { :controller => 'news', :action => 'index', :project_id => '567' }
276 258 )
277 259 assert_routing(
278 260 { :method => 'get', :path => "/projects/567/news.atom" },
279 261 { :controller => 'news', :action => 'index', :format => 'atom',
280 262 :project_id => '567' }
281 263 )
282 264 assert_routing(
283 265 { :method => 'get', :path => "/projects/567/news.xml" },
284 266 { :controller => 'news', :action => 'index', :format => 'xml',
285 267 :project_id => '567' }
286 268 )
287 269 assert_routing(
288 270 { :method => 'get', :path => "/projects/567/news.json" },
289 271 { :controller => 'news', :action => 'index', :format => 'json',
290 272 :project_id => '567' }
291 273 )
292 274 assert_routing(
293 275 { :method => 'get', :path => "/news/2" },
294 276 { :controller => 'news', :action => 'show', :id => '2' }
295 277 )
296 278 assert_routing(
297 279 { :method => 'get', :path => "/projects/567/news/new" },
298 280 { :controller => 'news', :action => 'new', :project_id => '567' }
299 281 )
300 282 assert_routing(
301 283 { :method => 'get', :path => "/news/234" },
302 284 { :controller => 'news', :action => 'show', :id => '234' }
303 285 )
304 286 assert_routing(
305 287 { :method => 'get', :path => "/news/567/edit" },
306 288 { :controller => 'news', :action => 'edit', :id => '567' }
307 289 )
308 290 assert_routing(
309 291 { :method => 'get', :path => "/news/preview" },
310 292 { :controller => 'previews', :action => 'news' }
311 293 )
312 294 assert_routing(
313 295 { :method => 'post', :path => "/projects/567/news" },
314 296 { :controller => 'news', :action => 'create', :project_id => '567' }
315 297 )
316 298 assert_routing(
317 299 { :method => 'post', :path => "/news/567/comments" },
318 300 { :controller => 'comments', :action => 'create', :id => '567' }
319 301 )
320 302 assert_routing(
321 303 { :method => 'put', :path => "/news/567" },
322 304 { :controller => 'news', :action => 'update', :id => '567' }
323 305 )
324 306 assert_routing(
325 307 { :method => 'delete', :path => "/news/567" },
326 308 { :controller => 'news', :action => 'destroy', :id => '567' }
327 309 )
328 310 assert_routing(
329 311 { :method => 'delete', :path => "/news/567/comments/15" },
330 312 { :controller => 'comments', :action => 'destroy', :id => '567',
331 313 :comment_id => '15' }
332 314 )
333 315 end
334 316
335 317 def test_projects
336 318 assert_routing(
337 319 { :method => 'get', :path => "/projects" },
338 320 { :controller => 'projects', :action => 'index' }
339 321 )
340 322 assert_routing(
341 323 { :method => 'get', :path => "/projects.atom" },
342 324 { :controller => 'projects', :action => 'index', :format => 'atom' }
343 325 )
344 326 assert_routing(
345 327 { :method => 'get', :path => "/projects.xml" },
346 328 { :controller => 'projects', :action => 'index', :format => 'xml' }
347 329 )
348 330 assert_routing(
349 331 { :method => 'get', :path => "/projects/new" },
350 332 { :controller => 'projects', :action => 'new' }
351 333 )
352 334 assert_routing(
353 335 { :method => 'get', :path => "/projects/test" },
354 336 { :controller => 'projects', :action => 'show', :id => 'test' }
355 337 )
356 338 assert_routing(
357 339 { :method => 'get', :path => "/projects/1.xml" },
358 340 { :controller => 'projects', :action => 'show', :id => '1',
359 341 :format => 'xml' }
360 342 )
361 343 assert_routing(
362 344 { :method => 'get', :path => "/projects/4223/settings" },
363 345 { :controller => 'projects', :action => 'settings', :id => '4223' }
364 346 )
365 347 assert_routing(
366 348 { :method => 'get', :path => "/projects/4223/settings/members" },
367 349 { :controller => 'projects', :action => 'settings', :id => '4223',
368 350 :tab => 'members' }
369 351 )
370 352 assert_routing(
371 353 { :method => 'get', :path => "/projects/33/roadmap" },
372 354 { :controller => 'versions', :action => 'index', :project_id => '33' }
373 355 )
374 356 assert_routing(
375 357 { :method => 'get', :path => "/projects/33/activity" },
376 358 { :controller => 'activities', :action => 'index', :id => '33' }
377 359 )
378 360 assert_routing(
379 361 { :method => 'get', :path => "/projects/33/activity.atom" },
380 362 { :controller => 'activities', :action => 'index', :id => '33',
381 363 :format => 'atom' }
382 364 )
383 365 assert_routing(
384 366 { :method => 'post', :path => "/projects" },
385 367 { :controller => 'projects', :action => 'create' }
386 368 )
387 369 assert_routing(
388 370 { :method => 'post', :path => "/projects.xml" },
389 371 { :controller => 'projects', :action => 'create', :format => 'xml' }
390 372 )
391 373 assert_routing(
392 374 { :method => 'post', :path => "/projects/64/archive" },
393 375 { :controller => 'projects', :action => 'archive', :id => '64' }
394 376 )
395 377 assert_routing(
396 378 { :method => 'post', :path => "/projects/64/unarchive" },
397 379 { :controller => 'projects', :action => 'unarchive', :id => '64' }
398 380 )
399 381 assert_routing(
400 382 { :method => 'put', :path => "/projects/64/enumerations" },
401 383 { :controller => 'project_enumerations', :action => 'update',
402 384 :project_id => '64' }
403 385 )
404 386 assert_routing(
405 387 { :method => 'put', :path => "/projects/4223" },
406 388 { :controller => 'projects', :action => 'update', :id => '4223' }
407 389 )
408 390 assert_routing(
409 391 { :method => 'put', :path => "/projects/1.xml" },
410 392 { :controller => 'projects', :action => 'update', :id => '1',
411 393 :format => 'xml' }
412 394 )
413 395 assert_routing(
414 396 { :method => 'delete', :path => "/projects/64" },
415 397 { :controller => 'projects', :action => 'destroy', :id => '64' }
416 398 )
417 399 assert_routing(
418 400 { :method => 'delete', :path => "/projects/1.xml" },
419 401 { :controller => 'projects', :action => 'destroy', :id => '1',
420 402 :format => 'xml' }
421 403 )
422 404 assert_routing(
423 405 { :method => 'delete', :path => "/projects/64/enumerations" },
424 406 { :controller => 'project_enumerations', :action => 'destroy',
425 407 :project_id => '64' }
426 408 )
427 409 end
428 410
429 411 def test_queries
430 412 assert_routing(
431 413 { :method => 'get', :path => "/queries.xml" },
432 414 { :controller => 'queries', :action => 'index', :format => 'xml' }
433 415 )
434 416 assert_routing(
435 417 { :method => 'get', :path => "/queries.json" },
436 418 { :controller => 'queries', :action => 'index', :format => 'json' }
437 419 )
438 420 assert_routing(
439 421 { :method => 'get', :path => "/queries/new" },
440 422 { :controller => 'queries', :action => 'new' }
441 423 )
442 424 assert_routing(
443 425 { :method => 'get', :path => "/projects/redmine/queries/new" },
444 426 { :controller => 'queries', :action => 'new', :project_id => 'redmine' }
445 427 )
446 428 assert_routing(
447 429 { :method => 'post', :path => "/queries" },
448 430 { :controller => 'queries', :action => 'create' }
449 431 )
450 432 assert_routing(
451 433 { :method => 'post', :path => "/projects/redmine/queries" },
452 434 { :controller => 'queries', :action => 'create', :project_id => 'redmine' }
453 435 )
454 436 assert_routing(
455 437 { :method => 'get', :path => "/queries/1/edit" },
456 438 { :controller => 'queries', :action => 'edit', :id => '1' }
457 439 )
458 440 assert_routing(
459 441 { :method => 'put', :path => "/queries/1" },
460 442 { :controller => 'queries', :action => 'update', :id => '1' }
461 443 )
462 444 assert_routing(
463 445 { :method => 'delete', :path => "/queries/1" },
464 446 { :controller => 'queries', :action => 'destroy', :id => '1' }
465 447 )
466 448 end
467 449
468 450 def test_roles
469 451 assert_routing(
470 452 { :method => 'get', :path => "/roles" },
471 453 { :controller => 'roles', :action => 'index' }
472 454 )
473 455 assert_routing(
474 456 { :method => 'get', :path => "/roles/new" },
475 457 { :controller => 'roles', :action => 'new' }
476 458 )
477 459 assert_routing(
478 460 { :method => 'post', :path => "/roles" },
479 461 { :controller => 'roles', :action => 'create' }
480 462 )
481 463 assert_routing(
482 464 { :method => 'get', :path => "/roles/2/edit" },
483 465 { :controller => 'roles', :action => 'edit', :id => '2' }
484 466 )
485 467 assert_routing(
486 468 { :method => 'put', :path => "/roles/2" },
487 469 { :controller => 'roles', :action => 'update', :id => '2' }
488 470 )
489 471 assert_routing(
490 472 { :method => 'delete', :path => "/roles/2" },
491 473 { :controller => 'roles', :action => 'destroy', :id => '2' }
492 474 )
493 475 assert_routing(
494 476 { :method => 'get', :path => "/roles/permissions" },
495 477 { :controller => 'roles', :action => 'permissions' }
496 478 )
497 479 assert_routing(
498 480 { :method => 'post', :path => "/roles/permissions" },
499 481 { :controller => 'roles', :action => 'permissions' }
500 482 )
501 483 end
502 484
503 485 def test_timelogs_global
504 486 assert_routing(
505 487 { :method => 'get', :path => "/time_entries" },
506 488 { :controller => 'timelog', :action => 'index' }
507 489 )
508 490 assert_routing(
509 491 { :method => 'get', :path => "/time_entries.csv" },
510 492 { :controller => 'timelog', :action => 'index', :format => 'csv' }
511 493 )
512 494 assert_routing(
513 495 { :method => 'get', :path => "/time_entries.atom" },
514 496 { :controller => 'timelog', :action => 'index', :format => 'atom' }
515 497 )
516 498 assert_routing(
517 499 { :method => 'get', :path => "/time_entries/new" },
518 500 { :controller => 'timelog', :action => 'new' }
519 501 )
520 502 assert_routing(
521 503 { :method => 'get', :path => "/time_entries/22/edit" },
522 504 { :controller => 'timelog', :action => 'edit', :id => '22' }
523 505 )
524 506 assert_routing(
525 507 { :method => 'post', :path => "/time_entries" },
526 508 { :controller => 'timelog', :action => 'create' }
527 509 )
528 510 assert_routing(
529 511 { :method => 'put', :path => "/time_entries/22" },
530 512 { :controller => 'timelog', :action => 'update', :id => '22' }
531 513 )
532 514 assert_routing(
533 515 { :method => 'delete', :path => "/time_entries/55" },
534 516 { :controller => 'timelog', :action => 'destroy', :id => '55' }
535 517 )
536 518 end
537 519
538 520 def test_timelogs_scoped_under_project
539 521 assert_routing(
540 522 { :method => 'get', :path => "/projects/567/time_entries" },
541 523 { :controller => 'timelog', :action => 'index', :project_id => '567' }
542 524 )
543 525 assert_routing(
544 526 { :method => 'get', :path => "/projects/567/time_entries.csv" },
545 527 { :controller => 'timelog', :action => 'index', :project_id => '567',
546 528 :format => 'csv' }
547 529 )
548 530 assert_routing(
549 531 { :method => 'get', :path => "/projects/567/time_entries.atom" },
550 532 { :controller => 'timelog', :action => 'index', :project_id => '567',
551 533 :format => 'atom' }
552 534 )
553 535 assert_routing(
554 536 { :method => 'get', :path => "/projects/567/time_entries/new" },
555 537 { :controller => 'timelog', :action => 'new', :project_id => '567' }
556 538 )
557 539 assert_routing(
558 540 { :method => 'get', :path => "/projects/567/time_entries/22/edit" },
559 541 { :controller => 'timelog', :action => 'edit',
560 542 :id => '22', :project_id => '567' }
561 543 )
562 544 assert_routing(
563 545 { :method => 'post', :path => "/projects/567/time_entries" },
564 546 { :controller => 'timelog', :action => 'create',
565 547 :project_id => '567' }
566 548 )
567 549 assert_routing(
568 550 { :method => 'put', :path => "/projects/567/time_entries/22" },
569 551 { :controller => 'timelog', :action => 'update',
570 552 :id => '22', :project_id => '567' }
571 553 )
572 554 assert_routing(
573 555 { :method => 'delete', :path => "/projects/567/time_entries/55" },
574 556 { :controller => 'timelog', :action => 'destroy',
575 557 :id => '55', :project_id => '567' }
576 558 )
577 559 end
578 560
579 561 def test_timelogs_scoped_under_issues
580 562 assert_routing(
581 563 { :method => 'get', :path => "/issues/234/time_entries" },
582 564 { :controller => 'timelog', :action => 'index', :issue_id => '234' }
583 565 )
584 566 assert_routing(
585 567 { :method => 'get', :path => "/issues/234/time_entries.csv" },
586 568 { :controller => 'timelog', :action => 'index', :issue_id => '234',
587 569 :format => 'csv' }
588 570 )
589 571 assert_routing(
590 572 { :method => 'get', :path => "/issues/234/time_entries.atom" },
591 573 { :controller => 'timelog', :action => 'index', :issue_id => '234',
592 574 :format => 'atom' }
593 575 )
594 576 assert_routing(
595 577 { :method => 'get', :path => "/issues/234/time_entries/new" },
596 578 { :controller => 'timelog', :action => 'new', :issue_id => '234' }
597 579 )
598 580 assert_routing(
599 581 { :method => 'get', :path => "/issues/234/time_entries/22/edit" },
600 582 { :controller => 'timelog', :action => 'edit', :id => '22',
601 583 :issue_id => '234' }
602 584 )
603 585 assert_routing(
604 586 { :method => 'post', :path => "/issues/234/time_entries" },
605 587 { :controller => 'timelog', :action => 'create', :issue_id => '234' }
606 588 )
607 589 assert_routing(
608 590 { :method => 'put', :path => "/issues/234/time_entries/22" },
609 591 { :controller => 'timelog', :action => 'update', :id => '22',
610 592 :issue_id => '234' }
611 593 )
612 594 assert_routing(
613 595 { :method => 'delete', :path => "/issues/234/time_entries/55" },
614 596 { :controller => 'timelog', :action => 'destroy', :id => '55',
615 597 :issue_id => '234' }
616 598 )
617 599 end
618 600
619 601 def test_timelogs_scoped_under_project_and_issues
620 602 assert_routing(
621 603 { :method => 'get',
622 604 :path => "/projects/ecookbook/issues/234/time_entries" },
623 605 { :controller => 'timelog', :action => 'index',
624 606 :issue_id => '234', :project_id => 'ecookbook' }
625 607 )
626 608 assert_routing(
627 609 { :method => 'get',
628 610 :path => "/projects/ecookbook/issues/234/time_entries.csv" },
629 611 { :controller => 'timelog', :action => 'index',
630 612 :issue_id => '234', :project_id => 'ecookbook', :format => 'csv' }
631 613 )
632 614 assert_routing(
633 615 { :method => 'get',
634 616 :path => "/projects/ecookbook/issues/234/time_entries.atom" },
635 617 { :controller => 'timelog', :action => 'index',
636 618 :issue_id => '234', :project_id => 'ecookbook', :format => 'atom' }
637 619 )
638 620 assert_routing(
639 621 { :method => 'get',
640 622 :path => "/projects/ecookbook/issues/234/time_entries/new" },
641 623 { :controller => 'timelog', :action => 'new',
642 624 :issue_id => '234', :project_id => 'ecookbook' }
643 625 )
644 626 assert_routing(
645 627 { :method => 'get',
646 628 :path => "/projects/ecookbook/issues/234/time_entries/22/edit" },
647 629 { :controller => 'timelog', :action => 'edit', :id => '22',
648 630 :issue_id => '234', :project_id => 'ecookbook' }
649 631 )
650 632 assert_routing(
651 633 { :method => 'post',
652 634 :path => "/projects/ecookbook/issues/234/time_entries" },
653 635 { :controller => 'timelog', :action => 'create',
654 636 :issue_id => '234', :project_id => 'ecookbook' }
655 637 )
656 638 assert_routing(
657 639 { :method => 'put',
658 640 :path => "/projects/ecookbook/issues/234/time_entries/22" },
659 641 { :controller => 'timelog', :action => 'update', :id => '22',
660 642 :issue_id => '234', :project_id => 'ecookbook' }
661 643 )
662 644 assert_routing(
663 645 { :method => 'delete',
664 646 :path => "/projects/ecookbook/issues/234/time_entries/55" },
665 647 { :controller => 'timelog', :action => 'destroy', :id => '55',
666 648 :issue_id => '234', :project_id => 'ecookbook' }
667 649 )
668 650 assert_routing(
669 651 { :method => 'get',
670 652 :path => "/time_entries/report" },
671 653 { :controller => 'timelog', :action => 'report' }
672 654 )
673 655 assert_routing(
674 656 { :method => 'get',
675 657 :path => "/projects/567/time_entries/report" },
676 658 { :controller => 'timelog', :action => 'report', :project_id => '567' }
677 659 )
678 660 assert_routing(
679 661 { :method => 'get',
680 662 :path => "/projects/567/time_entries/report.csv" },
681 663 { :controller => 'timelog', :action => 'report', :project_id => '567',
682 664 :format => 'csv' }
683 665 )
684 666 end
685 667
686 668 def test_users
687 669 assert_routing(
688 670 { :method => 'get', :path => "/users" },
689 671 { :controller => 'users', :action => 'index' }
690 672 )
691 673 assert_routing(
692 674 { :method => 'get', :path => "/users.xml" },
693 675 { :controller => 'users', :action => 'index', :format => 'xml' }
694 676 )
695 677 assert_routing(
696 678 { :method => 'get', :path => "/users/44" },
697 679 { :controller => 'users', :action => 'show', :id => '44' }
698 680 )
699 681 assert_routing(
700 682 { :method => 'get', :path => "/users/44.xml" },
701 683 { :controller => 'users', :action => 'show', :id => '44',
702 684 :format => 'xml' }
703 685 )
704 686 assert_routing(
705 687 { :method => 'get', :path => "/users/current" },
706 688 { :controller => 'users', :action => 'show', :id => 'current' }
707 689 )
708 690 assert_routing(
709 691 { :method => 'get', :path => "/users/current.xml" },
710 692 { :controller => 'users', :action => 'show', :id => 'current',
711 693 :format => 'xml' }
712 694 )
713 695 assert_routing(
714 696 { :method => 'get', :path => "/users/new" },
715 697 { :controller => 'users', :action => 'new' }
716 698 )
717 699 assert_routing(
718 700 { :method => 'get', :path => "/users/444/edit" },
719 701 { :controller => 'users', :action => 'edit', :id => '444' }
720 702 )
721 703 assert_routing(
722 704 { :method => 'post', :path => "/users" },
723 705 { :controller => 'users', :action => 'create' }
724 706 )
725 707 assert_routing(
726 708 { :method => 'post', :path => "/users.xml" },
727 709 { :controller => 'users', :action => 'create', :format => 'xml' }
728 710 )
729 711 assert_routing(
730 712 { :method => 'put', :path => "/users/444" },
731 713 { :controller => 'users', :action => 'update', :id => '444' }
732 714 )
733 715 assert_routing(
734 716 { :method => 'put', :path => "/users/444.xml" },
735 717 { :controller => 'users', :action => 'update', :id => '444',
736 718 :format => 'xml' }
737 719 )
738 720 assert_routing(
739 721 { :method => 'delete', :path => "/users/44" },
740 722 { :controller => 'users', :action => 'destroy', :id => '44' }
741 723 )
742 724 assert_routing(
743 725 { :method => 'delete', :path => "/users/44.xml" },
744 726 { :controller => 'users', :action => 'destroy', :id => '44',
745 727 :format => 'xml' }
746 728 )
747 729 assert_routing(
748 730 { :method => 'post', :path => "/users/123/memberships" },
749 731 { :controller => 'users', :action => 'edit_membership',
750 732 :id => '123' }
751 733 )
752 734 assert_routing(
753 735 { :method => 'put', :path => "/users/123/memberships/55" },
754 736 { :controller => 'users', :action => 'edit_membership',
755 737 :id => '123', :membership_id => '55' }
756 738 )
757 739 assert_routing(
758 740 { :method => 'delete', :path => "/users/123/memberships/55" },
759 741 { :controller => 'users', :action => 'destroy_membership',
760 742 :id => '123', :membership_id => '55' }
761 743 )
762 744 end
763 745
764 746 def test_welcome
765 747 assert_routing(
766 748 { :method => 'get', :path => "/robots.txt" },
767 749 { :controller => 'welcome', :action => 'robots' }
768 750 )
769 751 end
770 752
771 753 def test_wiki_singular_projects_pages
772 754 assert_routing(
773 755 { :method => 'get', :path => "/projects/567/wiki" },
774 756 { :controller => 'wiki', :action => 'show', :project_id => '567' }
775 757 )
776 758 assert_routing(
777 759 { :method => 'get', :path => "/projects/567/wiki/lalala" },
778 760 { :controller => 'wiki', :action => 'show', :project_id => '567',
779 761 :id => 'lalala' }
780 762 )
781 763 assert_routing(
782 764 { :method => 'get', :path => "/projects/567/wiki/my_page/edit" },
783 765 { :controller => 'wiki', :action => 'edit', :project_id => '567',
784 766 :id => 'my_page' }
785 767 )
786 768 assert_routing(
787 769 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/history" },
788 770 { :controller => 'wiki', :action => 'history', :project_id => '1',
789 771 :id => 'CookBook_documentation' }
790 772 )
791 773 assert_routing(
792 774 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff" },
793 775 { :controller => 'wiki', :action => 'diff', :project_id => '1',
794 776 :id => 'CookBook_documentation' }
795 777 )
796 778 assert_routing(
797 779 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2" },
798 780 { :controller => 'wiki', :action => 'diff', :project_id => '1',
799 781 :id => 'CookBook_documentation', :version => '2' }
800 782 )
801 783 assert_routing(
802 784 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2/vs/1" },
803 785 { :controller => 'wiki', :action => 'diff', :project_id => '1',
804 786 :id => 'CookBook_documentation', :version => '2', :version_from => '1' }
805 787 )
806 788 assert_routing(
807 789 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/annotate/2" },
808 790 { :controller => 'wiki', :action => 'annotate', :project_id => '1',
809 791 :id => 'CookBook_documentation', :version => '2' }
810 792 )
811 793 assert_routing(
812 794 { :method => 'get', :path => "/projects/22/wiki/ladida/rename" },
813 795 { :controller => 'wiki', :action => 'rename', :project_id => '22',
814 796 :id => 'ladida' }
815 797 )
816 798 assert_routing(
817 799 { :method => 'get', :path => "/projects/567/wiki/index" },
818 800 { :controller => 'wiki', :action => 'index', :project_id => '567' }
819 801 )
820 802 assert_routing(
821 803 { :method => 'get', :path => "/projects/567/wiki/date_index" },
822 804 { :controller => 'wiki', :action => 'date_index', :project_id => '567' }
823 805 )
824 806 assert_routing(
825 807 { :method => 'get', :path => "/projects/567/wiki/export" },
826 808 { :controller => 'wiki', :action => 'export', :project_id => '567' }
827 809 )
828 810 assert_routing(
829 811 { :method => 'post', :path => "/projects/567/wiki/CookBook_documentation/preview" },
830 812 { :controller => 'wiki', :action => 'preview', :project_id => '567',
831 813 :id => 'CookBook_documentation' }
832 814 )
833 815 assert_routing(
834 816 { :method => 'post', :path => "/projects/22/wiki/ladida/rename" },
835 817 { :controller => 'wiki', :action => 'rename', :project_id => '22',
836 818 :id => 'ladida' }
837 819 )
838 820 assert_routing(
839 821 { :method => 'post', :path => "/projects/22/wiki/ladida/protect" },
840 822 { :controller => 'wiki', :action => 'protect', :project_id => '22',
841 823 :id => 'ladida' }
842 824 )
843 825 assert_routing(
844 826 { :method => 'post', :path => "/projects/22/wiki/ladida/add_attachment" },
845 827 { :controller => 'wiki', :action => 'add_attachment', :project_id => '22',
846 828 :id => 'ladida' }
847 829 )
848 830 assert_routing(
849 831 { :method => 'put', :path => "/projects/567/wiki/my_page" },
850 832 { :controller => 'wiki', :action => 'update', :project_id => '567',
851 833 :id => 'my_page' }
852 834 )
853 835 assert_routing(
854 836 { :method => 'delete', :path => "/projects/22/wiki/ladida" },
855 837 { :controller => 'wiki', :action => 'destroy', :project_id => '22',
856 838 :id => 'ladida' }
857 839 )
858 840 end
859 841
860 842 def test_wikis_plural_admin_setup
861 843 assert_routing(
862 844 { :method => 'get', :path => "/projects/ladida/wiki/destroy" },
863 845 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
864 846 )
865 847 assert_routing(
866 848 { :method => 'post', :path => "/projects/ladida/wiki" },
867 849 { :controller => 'wikis', :action => 'edit', :id => 'ladida' }
868 850 )
869 851 assert_routing(
870 852 { :method => 'post', :path => "/projects/ladida/wiki/destroy" },
871 853 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
872 854 )
873 855 end
874 856 end
General Comments 0
You need to be logged in to leave comments. Login now