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