@@ -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 |
@@ -427,84 +427,6 class RoutingTest < ActionController::IntegrationTest | |||
|
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" }, |
General Comments 0
You need to be logged in to leave comments.
Login now