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