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