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