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