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