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