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