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