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