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