##// END OF EJS Templates
test: route: move users tests to new file...
Toshi MARUYAMA -
r8229:6d3bbd493381
parent child
Show More
@@ -0,0 +1,98
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 RoutingUsersTest < ActionController::IntegrationTest
21 def test_users
22 assert_routing(
23 { :method => 'get', :path => "/users" },
24 { :controller => 'users', :action => 'index' }
25 )
26 assert_routing(
27 { :method => 'get', :path => "/users.xml" },
28 { :controller => 'users', :action => 'index', :format => 'xml' }
29 )
30 assert_routing(
31 { :method => 'get', :path => "/users/44" },
32 { :controller => 'users', :action => 'show', :id => '44' }
33 )
34 assert_routing(
35 { :method => 'get', :path => "/users/44.xml" },
36 { :controller => 'users', :action => 'show', :id => '44',
37 :format => 'xml' }
38 )
39 assert_routing(
40 { :method => 'get', :path => "/users/current" },
41 { :controller => 'users', :action => 'show', :id => 'current' }
42 )
43 assert_routing(
44 { :method => 'get', :path => "/users/current.xml" },
45 { :controller => 'users', :action => 'show', :id => 'current',
46 :format => 'xml' }
47 )
48 assert_routing(
49 { :method => 'get', :path => "/users/new" },
50 { :controller => 'users', :action => 'new' }
51 )
52 assert_routing(
53 { :method => 'get', :path => "/users/444/edit" },
54 { :controller => 'users', :action => 'edit', :id => '444' }
55 )
56 assert_routing(
57 { :method => 'post', :path => "/users" },
58 { :controller => 'users', :action => 'create' }
59 )
60 assert_routing(
61 { :method => 'post', :path => "/users.xml" },
62 { :controller => 'users', :action => 'create', :format => 'xml' }
63 )
64 assert_routing(
65 { :method => 'put', :path => "/users/444" },
66 { :controller => 'users', :action => 'update', :id => '444' }
67 )
68 assert_routing(
69 { :method => 'put', :path => "/users/444.xml" },
70 { :controller => 'users', :action => 'update', :id => '444',
71 :format => 'xml' }
72 )
73 assert_routing(
74 { :method => 'delete', :path => "/users/44" },
75 { :controller => 'users', :action => 'destroy', :id => '44' }
76 )
77 assert_routing(
78 { :method => 'delete', :path => "/users/44.xml" },
79 { :controller => 'users', :action => 'destroy', :id => '44',
80 :format => 'xml' }
81 )
82 assert_routing(
83 { :method => 'post', :path => "/users/123/memberships" },
84 { :controller => 'users', :action => 'edit_membership',
85 :id => '123' }
86 )
87 assert_routing(
88 { :method => 'put', :path => "/users/123/memberships/55" },
89 { :controller => 'users', :action => 'edit_membership',
90 :id => '123', :membership_id => '55' }
91 )
92 assert_routing(
93 { :method => 'delete', :path => "/users/123/memberships/55" },
94 { :controller => 'users', :action => 'destroy_membership',
95 :id => '123', :membership_id => '55' }
96 )
97 end
98 end
@@ -1,618 +1,540
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2011 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 require File.expand_path('../../test_helper', __FILE__)
19 19
20 20 class RoutingTest < ActionController::IntegrationTest
21 21 def test_issues_rest_actions
22 22 assert_routing(
23 23 { :method => 'get', :path => "/issues" },
24 24 { :controller => 'issues', :action => 'index' }
25 25 )
26 26 assert_routing(
27 27 { :method => 'get', :path => "/issues.pdf" },
28 28 { :controller => 'issues', :action => 'index', :format => 'pdf' }
29 29 )
30 30 assert_routing(
31 31 { :method => 'get', :path => "/issues.atom" },
32 32 { :controller => 'issues', :action => 'index', :format => 'atom' }
33 33 )
34 34 assert_routing(
35 35 { :method => 'get', :path => "/issues.xml" },
36 36 { :controller => 'issues', :action => 'index', :format => 'xml' }
37 37 )
38 38 assert_routing(
39 39 { :method => 'get', :path => "/projects/23/issues" },
40 40 { :controller => 'issues', :action => 'index', :project_id => '23' }
41 41 )
42 42 assert_routing(
43 43 { :method => 'get', :path => "/projects/23/issues.pdf" },
44 44 { :controller => 'issues', :action => 'index', :project_id => '23',
45 45 :format => 'pdf' }
46 46 )
47 47 assert_routing(
48 48 { :method => 'get', :path => "/projects/23/issues.atom" },
49 49 { :controller => 'issues', :action => 'index', :project_id => '23',
50 50 :format => 'atom' }
51 51 )
52 52 assert_routing(
53 53 { :method => 'get', :path => "/projects/23/issues.xml" },
54 54 { :controller => 'issues', :action => 'index', :project_id => '23',
55 55 :format => 'xml' }
56 56 )
57 57 assert_routing(
58 58 { :method => 'get', :path => "/issues/64" },
59 59 { :controller => 'issues', :action => 'show', :id => '64' }
60 60 )
61 61 assert_routing(
62 62 { :method => 'get', :path => "/issues/64.pdf" },
63 63 { :controller => 'issues', :action => 'show', :id => '64',
64 64 :format => 'pdf' }
65 65 )
66 66 assert_routing(
67 67 { :method => 'get', :path => "/issues/64.atom" },
68 68 { :controller => 'issues', :action => 'show', :id => '64',
69 69 :format => 'atom' }
70 70 )
71 71 assert_routing(
72 72 { :method => 'get', :path => "/issues/64.xml" },
73 73 { :controller => 'issues', :action => 'show', :id => '64',
74 74 :format => 'xml' }
75 75 )
76 76 assert_routing(
77 77 { :method => 'get', :path => "/projects/23/issues/new" },
78 78 { :controller => 'issues', :action => 'new', :project_id => '23' }
79 79 )
80 80 end
81 81
82 82 def test_issues_form_update
83 83 assert_routing(
84 84 { :method => 'post', :path => "/projects/23/issues/new" },
85 85 { :controller => 'issues', :action => 'new', :project_id => '23' }
86 86 )
87 87 assert_routing(
88 88 { :method => 'post', :path => "/projects/23/issues" },
89 89 { :controller => 'issues', :action => 'create', :project_id => '23' }
90 90 )
91 91 assert_routing(
92 92 { :method => 'post', :path => "/issues.xml" },
93 93 { :controller => 'issues', :action => 'create', :format => 'xml' }
94 94 )
95 95 assert_routing(
96 96 { :method => 'get', :path => "/issues/64/edit" },
97 97 { :controller => 'issues', :action => 'edit', :id => '64' }
98 98 )
99 99 assert_routing(
100 100 { :method => 'put', :path => "/issues/1.xml" },
101 101 { :controller => 'issues', :action => 'update', :id => '1',
102 102 :format => 'xml' }
103 103 )
104 104 assert_routing(
105 105 { :method => 'delete', :path => "/issues/1.xml" },
106 106 { :controller => 'issues', :action => 'destroy', :id => '1',
107 107 :format => 'xml' }
108 108 )
109 109 end
110 110
111 111 def test_issues_extra_actions
112 112 assert_routing(
113 113 { :method => 'get', :path => "/projects/23/issues/64/copy" },
114 114 { :controller => 'issues', :action => 'new', :project_id => '23',
115 115 :copy_from => '64' }
116 116 )
117 117 assert_routing(
118 118 { :method => 'get', :path => "/issues/preview/123" },
119 119 { :controller => 'previews', :action => 'issue', :id => '123' }
120 120 )
121 121 assert_routing(
122 122 { :method => 'post', :path => "/issues/preview/123" },
123 123 { :controller => 'previews', :action => 'issue', :id => '123' }
124 124 )
125 125 assert_routing(
126 126 { :method => 'get', :path => "/issues/context_menu" },
127 127 { :controller => 'context_menus', :action => 'issues' }
128 128 )
129 129 assert_routing(
130 130 { :method => 'post', :path => "/issues/context_menu" },
131 131 { :controller => 'context_menus', :action => 'issues' }
132 132 )
133 133 assert_routing(
134 134 { :method => 'get', :path => "/issues/bulk_edit" },
135 135 { :controller => 'issues', :action => 'bulk_edit' }
136 136 )
137 137 assert_routing(
138 138 { :method => 'post', :path => "/issues/bulk_update" },
139 139 { :controller => 'issues', :action => 'bulk_update' }
140 140 )
141 141 end
142 142
143 143 def test_issue_categories
144 144 assert_routing(
145 145 { :method => 'get', :path => "/projects/foo/issue_categories" },
146 146 { :controller => 'issue_categories', :action => 'index',
147 147 :project_id => 'foo' }
148 148 )
149 149 assert_routing(
150 150 { :method => 'get', :path => "/projects/foo/issue_categories.xml" },
151 151 { :controller => 'issue_categories', :action => 'index',
152 152 :project_id => 'foo', :format => 'xml' }
153 153 )
154 154 assert_routing(
155 155 { :method => 'get', :path => "/projects/foo/issue_categories.json" },
156 156 { :controller => 'issue_categories', :action => 'index',
157 157 :project_id => 'foo', :format => 'json' }
158 158 )
159 159 assert_routing(
160 160 { :method => 'get', :path => "/projects/foo/issue_categories/new" },
161 161 { :controller => 'issue_categories', :action => 'new',
162 162 :project_id => 'foo' }
163 163 )
164 164 assert_routing(
165 165 { :method => 'post', :path => "/projects/foo/issue_categories" },
166 166 { :controller => 'issue_categories', :action => 'create',
167 167 :project_id => 'foo' }
168 168 )
169 169 assert_routing(
170 170 { :method => 'post', :path => "/projects/foo/issue_categories.xml" },
171 171 { :controller => 'issue_categories', :action => 'create',
172 172 :project_id => 'foo', :format => 'xml' }
173 173 )
174 174 assert_routing(
175 175 { :method => 'post', :path => "/projects/foo/issue_categories.json" },
176 176 { :controller => 'issue_categories', :action => 'create',
177 177 :project_id => 'foo', :format => 'json' }
178 178 )
179 179 assert_routing(
180 180 { :method => 'get', :path => "/issue_categories/1" },
181 181 { :controller => 'issue_categories', :action => 'show', :id => '1' }
182 182 )
183 183 assert_routing(
184 184 { :method => 'get', :path => "/issue_categories/1.xml" },
185 185 { :controller => 'issue_categories', :action => 'show', :id => '1',
186 186 :format => 'xml' }
187 187 )
188 188 assert_routing(
189 189 { :method => 'get', :path => "/issue_categories/1.json" },
190 190 { :controller => 'issue_categories', :action => 'show', :id => '1',
191 191 :format => 'json' }
192 192 )
193 193 assert_routing(
194 194 { :method => 'get', :path => "/issue_categories/1/edit" },
195 195 { :controller => 'issue_categories', :action => 'edit', :id => '1' }
196 196 )
197 197 assert_routing(
198 198 { :method => 'put', :path => "/issue_categories/1" },
199 199 { :controller => 'issue_categories', :action => 'update', :id => '1' }
200 200 )
201 201 assert_routing(
202 202 { :method => 'put', :path => "/issue_categories/1.xml" },
203 203 { :controller => 'issue_categories', :action => 'update', :id => '1',
204 204 :format => 'xml' }
205 205 )
206 206 assert_routing(
207 207 { :method => 'put', :path => "/issue_categories/1.json" },
208 208 { :controller => 'issue_categories', :action => 'update', :id => '1',
209 209 :format => 'json' }
210 210 )
211 211 assert_routing(
212 212 { :method => 'delete', :path => "/issue_categories/1" },
213 213 { :controller => 'issue_categories', :action => 'destroy', :id => '1' }
214 214 )
215 215 assert_routing(
216 216 { :method => 'delete', :path => "/issue_categories/1.xml" },
217 217 { :controller => 'issue_categories', :action => 'destroy', :id => '1',
218 218 :format => 'xml' }
219 219 )
220 220 assert_routing(
221 221 { :method => 'delete', :path => "/issue_categories/1.json" },
222 222 { :controller => 'issue_categories', :action => 'destroy', :id => '1',
223 223 :format => 'json' }
224 224 )
225 225 end
226 226
227 227 def test_news
228 228 assert_routing(
229 229 { :method => 'get', :path => "/news" },
230 230 { :controller => 'news', :action => 'index' }
231 231 )
232 232 assert_routing(
233 233 { :method => 'get', :path => "/news.atom" },
234 234 { :controller => 'news', :action => 'index', :format => 'atom' }
235 235 )
236 236 assert_routing(
237 237 { :method => 'get', :path => "/news.xml" },
238 238 { :controller => 'news', :action => 'index', :format => 'xml' }
239 239 )
240 240 assert_routing(
241 241 { :method => 'get', :path => "/news.json" },
242 242 { :controller => 'news', :action => 'index', :format => 'json' }
243 243 )
244 244 assert_routing(
245 245 { :method => 'get', :path => "/projects/567/news" },
246 246 { :controller => 'news', :action => 'index', :project_id => '567' }
247 247 )
248 248 assert_routing(
249 249 { :method => 'get', :path => "/projects/567/news.atom" },
250 250 { :controller => 'news', :action => 'index', :format => 'atom',
251 251 :project_id => '567' }
252 252 )
253 253 assert_routing(
254 254 { :method => 'get', :path => "/projects/567/news.xml" },
255 255 { :controller => 'news', :action => 'index', :format => 'xml',
256 256 :project_id => '567' }
257 257 )
258 258 assert_routing(
259 259 { :method => 'get', :path => "/projects/567/news.json" },
260 260 { :controller => 'news', :action => 'index', :format => 'json',
261 261 :project_id => '567' }
262 262 )
263 263 assert_routing(
264 264 { :method => 'get', :path => "/news/2" },
265 265 { :controller => 'news', :action => 'show', :id => '2' }
266 266 )
267 267 assert_routing(
268 268 { :method => 'get', :path => "/projects/567/news/new" },
269 269 { :controller => 'news', :action => 'new', :project_id => '567' }
270 270 )
271 271 assert_routing(
272 272 { :method => 'get', :path => "/news/234" },
273 273 { :controller => 'news', :action => 'show', :id => '234' }
274 274 )
275 275 assert_routing(
276 276 { :method => 'get', :path => "/news/567/edit" },
277 277 { :controller => 'news', :action => 'edit', :id => '567' }
278 278 )
279 279 assert_routing(
280 280 { :method => 'get', :path => "/news/preview" },
281 281 { :controller => 'previews', :action => 'news' }
282 282 )
283 283 assert_routing(
284 284 { :method => 'post', :path => "/projects/567/news" },
285 285 { :controller => 'news', :action => 'create', :project_id => '567' }
286 286 )
287 287 assert_routing(
288 288 { :method => 'post', :path => "/news/567/comments" },
289 289 { :controller => 'comments', :action => 'create', :id => '567' }
290 290 )
291 291 assert_routing(
292 292 { :method => 'put', :path => "/news/567" },
293 293 { :controller => 'news', :action => 'update', :id => '567' }
294 294 )
295 295 assert_routing(
296 296 { :method => 'delete', :path => "/news/567" },
297 297 { :controller => 'news', :action => 'destroy', :id => '567' }
298 298 )
299 299 assert_routing(
300 300 { :method => 'delete', :path => "/news/567/comments/15" },
301 301 { :controller => 'comments', :action => 'destroy', :id => '567',
302 302 :comment_id => '15' }
303 303 )
304 304 end
305 305
306 306 def test_projects
307 307 assert_routing(
308 308 { :method => 'get', :path => "/projects" },
309 309 { :controller => 'projects', :action => 'index' }
310 310 )
311 311 assert_routing(
312 312 { :method => 'get', :path => "/projects.atom" },
313 313 { :controller => 'projects', :action => 'index', :format => 'atom' }
314 314 )
315 315 assert_routing(
316 316 { :method => 'get', :path => "/projects.xml" },
317 317 { :controller => 'projects', :action => 'index', :format => 'xml' }
318 318 )
319 319 assert_routing(
320 320 { :method => 'get', :path => "/projects/new" },
321 321 { :controller => 'projects', :action => 'new' }
322 322 )
323 323 assert_routing(
324 324 { :method => 'get', :path => "/projects/test" },
325 325 { :controller => 'projects', :action => 'show', :id => 'test' }
326 326 )
327 327 assert_routing(
328 328 { :method => 'get', :path => "/projects/1.xml" },
329 329 { :controller => 'projects', :action => 'show', :id => '1',
330 330 :format => 'xml' }
331 331 )
332 332 assert_routing(
333 333 { :method => 'get', :path => "/projects/4223/settings" },
334 334 { :controller => 'projects', :action => 'settings', :id => '4223' }
335 335 )
336 336 assert_routing(
337 337 { :method => 'get', :path => "/projects/4223/settings/members" },
338 338 { :controller => 'projects', :action => 'settings', :id => '4223',
339 339 :tab => 'members' }
340 340 )
341 341 assert_routing(
342 342 { :method => 'get', :path => "/projects/33/roadmap" },
343 343 { :controller => 'versions', :action => 'index', :project_id => '33' }
344 344 )
345 345 assert_routing(
346 346 { :method => 'post', :path => "/projects" },
347 347 { :controller => 'projects', :action => 'create' }
348 348 )
349 349 assert_routing(
350 350 { :method => 'post', :path => "/projects.xml" },
351 351 { :controller => 'projects', :action => 'create', :format => 'xml' }
352 352 )
353 353 assert_routing(
354 354 { :method => 'post', :path => "/projects/64/archive" },
355 355 { :controller => 'projects', :action => 'archive', :id => '64' }
356 356 )
357 357 assert_routing(
358 358 { :method => 'post', :path => "/projects/64/unarchive" },
359 359 { :controller => 'projects', :action => 'unarchive', :id => '64' }
360 360 )
361 361 assert_routing(
362 362 { :method => 'put', :path => "/projects/64/enumerations" },
363 363 { :controller => 'project_enumerations', :action => 'update',
364 364 :project_id => '64' }
365 365 )
366 366 assert_routing(
367 367 { :method => 'put', :path => "/projects/4223" },
368 368 { :controller => 'projects', :action => 'update', :id => '4223' }
369 369 )
370 370 assert_routing(
371 371 { :method => 'put', :path => "/projects/1.xml" },
372 372 { :controller => 'projects', :action => 'update', :id => '1',
373 373 :format => 'xml' }
374 374 )
375 375 assert_routing(
376 376 { :method => 'delete', :path => "/projects/64" },
377 377 { :controller => 'projects', :action => 'destroy', :id => '64' }
378 378 )
379 379 assert_routing(
380 380 { :method => 'delete', :path => "/projects/1.xml" },
381 381 { :controller => 'projects', :action => 'destroy', :id => '1',
382 382 :format => 'xml' }
383 383 )
384 384 assert_routing(
385 385 { :method => 'delete', :path => "/projects/64/enumerations" },
386 386 { :controller => 'project_enumerations', :action => 'destroy',
387 387 :project_id => '64' }
388 388 )
389 389 end
390 390
391 391 def test_queries
392 392 assert_routing(
393 393 { :method => 'get', :path => "/queries.xml" },
394 394 { :controller => 'queries', :action => 'index', :format => 'xml' }
395 395 )
396 396 assert_routing(
397 397 { :method => 'get', :path => "/queries.json" },
398 398 { :controller => 'queries', :action => 'index', :format => 'json' }
399 399 )
400 400 assert_routing(
401 401 { :method => 'get', :path => "/queries/new" },
402 402 { :controller => 'queries', :action => 'new' }
403 403 )
404 404 assert_routing(
405 405 { :method => 'get', :path => "/projects/redmine/queries/new" },
406 406 { :controller => 'queries', :action => 'new', :project_id => 'redmine' }
407 407 )
408 408 assert_routing(
409 409 { :method => 'post', :path => "/queries" },
410 410 { :controller => 'queries', :action => 'create' }
411 411 )
412 412 assert_routing(
413 413 { :method => 'post', :path => "/projects/redmine/queries" },
414 414 { :controller => 'queries', :action => 'create', :project_id => 'redmine' }
415 415 )
416 416 assert_routing(
417 417 { :method => 'get', :path => "/queries/1/edit" },
418 418 { :controller => 'queries', :action => 'edit', :id => '1' }
419 419 )
420 420 assert_routing(
421 421 { :method => 'put', :path => "/queries/1" },
422 422 { :controller => 'queries', :action => 'update', :id => '1' }
423 423 )
424 424 assert_routing(
425 425 { :method => 'delete', :path => "/queries/1" },
426 426 { :controller => 'queries', :action => 'destroy', :id => '1' }
427 427 )
428 428 end
429 429
430 def test_users
431 assert_routing(
432 { :method => 'get', :path => "/users" },
433 { :controller => 'users', :action => 'index' }
434 )
435 assert_routing(
436 { :method => 'get', :path => "/users.xml" },
437 { :controller => 'users', :action => 'index', :format => 'xml' }
438 )
439 assert_routing(
440 { :method => 'get', :path => "/users/44" },
441 { :controller => 'users', :action => 'show', :id => '44' }
442 )
443 assert_routing(
444 { :method => 'get', :path => "/users/44.xml" },
445 { :controller => 'users', :action => 'show', :id => '44',
446 :format => 'xml' }
447 )
448 assert_routing(
449 { :method => 'get', :path => "/users/current" },
450 { :controller => 'users', :action => 'show', :id => 'current' }
451 )
452 assert_routing(
453 { :method => 'get', :path => "/users/current.xml" },
454 { :controller => 'users', :action => 'show', :id => 'current',
455 :format => 'xml' }
456 )
457 assert_routing(
458 { :method => 'get', :path => "/users/new" },
459 { :controller => 'users', :action => 'new' }
460 )
461 assert_routing(
462 { :method => 'get', :path => "/users/444/edit" },
463 { :controller => 'users', :action => 'edit', :id => '444' }
464 )
465 assert_routing(
466 { :method => 'post', :path => "/users" },
467 { :controller => 'users', :action => 'create' }
468 )
469 assert_routing(
470 { :method => 'post', :path => "/users.xml" },
471 { :controller => 'users', :action => 'create', :format => 'xml' }
472 )
473 assert_routing(
474 { :method => 'put', :path => "/users/444" },
475 { :controller => 'users', :action => 'update', :id => '444' }
476 )
477 assert_routing(
478 { :method => 'put', :path => "/users/444.xml" },
479 { :controller => 'users', :action => 'update', :id => '444',
480 :format => 'xml' }
481 )
482 assert_routing(
483 { :method => 'delete', :path => "/users/44" },
484 { :controller => 'users', :action => 'destroy', :id => '44' }
485 )
486 assert_routing(
487 { :method => 'delete', :path => "/users/44.xml" },
488 { :controller => 'users', :action => 'destroy', :id => '44',
489 :format => 'xml' }
490 )
491 assert_routing(
492 { :method => 'post', :path => "/users/123/memberships" },
493 { :controller => 'users', :action => 'edit_membership',
494 :id => '123' }
495 )
496 assert_routing(
497 { :method => 'put', :path => "/users/123/memberships/55" },
498 { :controller => 'users', :action => 'edit_membership',
499 :id => '123', :membership_id => '55' }
500 )
501 assert_routing(
502 { :method => 'delete', :path => "/users/123/memberships/55" },
503 { :controller => 'users', :action => 'destroy_membership',
504 :id => '123', :membership_id => '55' }
505 )
506 end
507
508 430 def test_welcome
509 431 assert_routing(
510 432 { :method => 'get', :path => "/robots.txt" },
511 433 { :controller => 'welcome', :action => 'robots' }
512 434 )
513 435 end
514 436
515 437 def test_wiki_singular_projects_pages
516 438 assert_routing(
517 439 { :method => 'get', :path => "/projects/567/wiki" },
518 440 { :controller => 'wiki', :action => 'show', :project_id => '567' }
519 441 )
520 442 assert_routing(
521 443 { :method => 'get', :path => "/projects/567/wiki/lalala" },
522 444 { :controller => 'wiki', :action => 'show', :project_id => '567',
523 445 :id => 'lalala' }
524 446 )
525 447 assert_routing(
526 448 { :method => 'get', :path => "/projects/567/wiki/my_page/edit" },
527 449 { :controller => 'wiki', :action => 'edit', :project_id => '567',
528 450 :id => 'my_page' }
529 451 )
530 452 assert_routing(
531 453 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/history" },
532 454 { :controller => 'wiki', :action => 'history', :project_id => '1',
533 455 :id => 'CookBook_documentation' }
534 456 )
535 457 assert_routing(
536 458 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff" },
537 459 { :controller => 'wiki', :action => 'diff', :project_id => '1',
538 460 :id => 'CookBook_documentation' }
539 461 )
540 462 assert_routing(
541 463 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2" },
542 464 { :controller => 'wiki', :action => 'diff', :project_id => '1',
543 465 :id => 'CookBook_documentation', :version => '2' }
544 466 )
545 467 assert_routing(
546 468 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2/vs/1" },
547 469 { :controller => 'wiki', :action => 'diff', :project_id => '1',
548 470 :id => 'CookBook_documentation', :version => '2', :version_from => '1' }
549 471 )
550 472 assert_routing(
551 473 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/annotate/2" },
552 474 { :controller => 'wiki', :action => 'annotate', :project_id => '1',
553 475 :id => 'CookBook_documentation', :version => '2' }
554 476 )
555 477 assert_routing(
556 478 { :method => 'get', :path => "/projects/22/wiki/ladida/rename" },
557 479 { :controller => 'wiki', :action => 'rename', :project_id => '22',
558 480 :id => 'ladida' }
559 481 )
560 482 assert_routing(
561 483 { :method => 'get', :path => "/projects/567/wiki/index" },
562 484 { :controller => 'wiki', :action => 'index', :project_id => '567' }
563 485 )
564 486 assert_routing(
565 487 { :method => 'get', :path => "/projects/567/wiki/date_index" },
566 488 { :controller => 'wiki', :action => 'date_index', :project_id => '567' }
567 489 )
568 490 assert_routing(
569 491 { :method => 'get', :path => "/projects/567/wiki/export" },
570 492 { :controller => 'wiki', :action => 'export', :project_id => '567' }
571 493 )
572 494 assert_routing(
573 495 { :method => 'post', :path => "/projects/567/wiki/CookBook_documentation/preview" },
574 496 { :controller => 'wiki', :action => 'preview', :project_id => '567',
575 497 :id => 'CookBook_documentation' }
576 498 )
577 499 assert_routing(
578 500 { :method => 'post', :path => "/projects/22/wiki/ladida/rename" },
579 501 { :controller => 'wiki', :action => 'rename', :project_id => '22',
580 502 :id => 'ladida' }
581 503 )
582 504 assert_routing(
583 505 { :method => 'post', :path => "/projects/22/wiki/ladida/protect" },
584 506 { :controller => 'wiki', :action => 'protect', :project_id => '22',
585 507 :id => 'ladida' }
586 508 )
587 509 assert_routing(
588 510 { :method => 'post', :path => "/projects/22/wiki/ladida/add_attachment" },
589 511 { :controller => 'wiki', :action => 'add_attachment', :project_id => '22',
590 512 :id => 'ladida' }
591 513 )
592 514 assert_routing(
593 515 { :method => 'put', :path => "/projects/567/wiki/my_page" },
594 516 { :controller => 'wiki', :action => 'update', :project_id => '567',
595 517 :id => 'my_page' }
596 518 )
597 519 assert_routing(
598 520 { :method => 'delete', :path => "/projects/22/wiki/ladida" },
599 521 { :controller => 'wiki', :action => 'destroy', :project_id => '22',
600 522 :id => 'ladida' }
601 523 )
602 524 end
603 525
604 526 def test_wikis_plural_admin_setup
605 527 assert_routing(
606 528 { :method => 'get', :path => "/projects/ladida/wiki/destroy" },
607 529 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
608 530 )
609 531 assert_routing(
610 532 { :method => 'post', :path => "/projects/ladida/wiki" },
611 533 { :controller => 'wikis', :action => 'edit', :id => 'ladida' }
612 534 )
613 535 assert_routing(
614 536 { :method => 'post', :path => "/projects/ladida/wiki/destroy" },
615 537 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
616 538 )
617 539 end
618 540 end
General Comments 0
You need to be logged in to leave comments. Login now