##// END OF EJS Templates
test: route: move members test to new file...
Toshi MARUYAMA -
r8222:904ec537b20b
parent child
Show More
@@ -0,0 +1,27
1 # Redmine - project management software
2 # Copyright (C) 2006-2011 Jean-Philippe Lang
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
18 require File.expand_path('../../../test_helper', __FILE__)
19
20 class RoutingMembersTest < ActionController::IntegrationTest
21 def test_members
22 assert_routing(
23 { :method => 'post', :path => "/projects/5234/members/new" },
24 { :controller => 'members', :action => 'new', :id => '5234' }
25 )
26 end
27 end
@@ -1,856 +1,849
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/auto_complete" },
118 { :method => 'get', :path => "/issues/auto_complete" },
119 { :controller => 'auto_completes', :action => 'issues' }
119 { :controller => 'auto_completes', :action => 'issues' }
120 )
120 )
121 assert_routing(
121 assert_routing(
122 { :method => 'get', :path => "/issues/preview/123" },
122 { :method => 'get', :path => "/issues/preview/123" },
123 { :controller => 'previews', :action => 'issue', :id => '123' }
123 { :controller => 'previews', :action => 'issue', :id => '123' }
124 )
124 )
125 assert_routing(
125 assert_routing(
126 { :method => 'post', :path => "/issues/preview/123" },
126 { :method => 'post', :path => "/issues/preview/123" },
127 { :controller => 'previews', :action => 'issue', :id => '123' }
127 { :controller => 'previews', :action => 'issue', :id => '123' }
128 )
128 )
129 assert_routing(
129 assert_routing(
130 { :method => 'get', :path => "/issues/context_menu" },
130 { :method => 'get', :path => "/issues/context_menu" },
131 { :controller => 'context_menus', :action => 'issues' }
131 { :controller => 'context_menus', :action => 'issues' }
132 )
132 )
133 assert_routing(
133 assert_routing(
134 { :method => 'post', :path => "/issues/context_menu" },
134 { :method => 'post', :path => "/issues/context_menu" },
135 { :controller => 'context_menus', :action => 'issues' }
135 { :controller => 'context_menus', :action => 'issues' }
136 )
136 )
137 assert_routing(
137 assert_routing(
138 { :method => 'get', :path => "/issues/bulk_edit" },
138 { :method => 'get', :path => "/issues/bulk_edit" },
139 { :controller => 'issues', :action => 'bulk_edit' }
139 { :controller => 'issues', :action => 'bulk_edit' }
140 )
140 )
141 assert_routing(
141 assert_routing(
142 { :method => 'post', :path => "/issues/bulk_update" },
142 { :method => 'post', :path => "/issues/bulk_update" },
143 { :controller => 'issues', :action => 'bulk_update' }
143 { :controller => 'issues', :action => 'bulk_update' }
144 )
144 )
145 end
145 end
146
146
147 def test_issue_categories
147 def test_issue_categories
148 assert_routing(
148 assert_routing(
149 { :method => 'get', :path => "/projects/foo/issue_categories" },
149 { :method => 'get', :path => "/projects/foo/issue_categories" },
150 { :controller => 'issue_categories', :action => 'index',
150 { :controller => 'issue_categories', :action => 'index',
151 :project_id => 'foo' }
151 :project_id => 'foo' }
152 )
152 )
153 assert_routing(
153 assert_routing(
154 { :method => 'get', :path => "/projects/foo/issue_categories.xml" },
154 { :method => 'get', :path => "/projects/foo/issue_categories.xml" },
155 { :controller => 'issue_categories', :action => 'index',
155 { :controller => 'issue_categories', :action => 'index',
156 :project_id => 'foo', :format => 'xml' }
156 :project_id => 'foo', :format => 'xml' }
157 )
157 )
158 assert_routing(
158 assert_routing(
159 { :method => 'get', :path => "/projects/foo/issue_categories.json" },
159 { :method => 'get', :path => "/projects/foo/issue_categories.json" },
160 { :controller => 'issue_categories', :action => 'index',
160 { :controller => 'issue_categories', :action => 'index',
161 :project_id => 'foo', :format => 'json' }
161 :project_id => 'foo', :format => 'json' }
162 )
162 )
163 assert_routing(
163 assert_routing(
164 { :method => 'get', :path => "/projects/foo/issue_categories/new" },
164 { :method => 'get', :path => "/projects/foo/issue_categories/new" },
165 { :controller => 'issue_categories', :action => 'new',
165 { :controller => 'issue_categories', :action => 'new',
166 :project_id => 'foo' }
166 :project_id => 'foo' }
167 )
167 )
168 assert_routing(
168 assert_routing(
169 { :method => 'post', :path => "/projects/foo/issue_categories" },
169 { :method => 'post', :path => "/projects/foo/issue_categories" },
170 { :controller => 'issue_categories', :action => 'create',
170 { :controller => 'issue_categories', :action => 'create',
171 :project_id => 'foo' }
171 :project_id => 'foo' }
172 )
172 )
173 assert_routing(
173 assert_routing(
174 { :method => 'post', :path => "/projects/foo/issue_categories.xml" },
174 { :method => 'post', :path => "/projects/foo/issue_categories.xml" },
175 { :controller => 'issue_categories', :action => 'create',
175 { :controller => 'issue_categories', :action => 'create',
176 :project_id => 'foo', :format => 'xml' }
176 :project_id => 'foo', :format => 'xml' }
177 )
177 )
178 assert_routing(
178 assert_routing(
179 { :method => 'post', :path => "/projects/foo/issue_categories.json" },
179 { :method => 'post', :path => "/projects/foo/issue_categories.json" },
180 { :controller => 'issue_categories', :action => 'create',
180 { :controller => 'issue_categories', :action => 'create',
181 :project_id => 'foo', :format => 'json' }
181 :project_id => 'foo', :format => 'json' }
182 )
182 )
183 assert_routing(
183 assert_routing(
184 { :method => 'get', :path => "/issue_categories/1" },
184 { :method => 'get', :path => "/issue_categories/1" },
185 { :controller => 'issue_categories', :action => 'show', :id => '1' }
185 { :controller => 'issue_categories', :action => 'show', :id => '1' }
186 )
186 )
187 assert_routing(
187 assert_routing(
188 { :method => 'get', :path => "/issue_categories/1.xml" },
188 { :method => 'get', :path => "/issue_categories/1.xml" },
189 { :controller => 'issue_categories', :action => 'show', :id => '1',
189 { :controller => 'issue_categories', :action => 'show', :id => '1',
190 :format => 'xml' }
190 :format => 'xml' }
191 )
191 )
192 assert_routing(
192 assert_routing(
193 { :method => 'get', :path => "/issue_categories/1.json" },
193 { :method => 'get', :path => "/issue_categories/1.json" },
194 { :controller => 'issue_categories', :action => 'show', :id => '1',
194 { :controller => 'issue_categories', :action => 'show', :id => '1',
195 :format => 'json' }
195 :format => 'json' }
196 )
196 )
197 assert_routing(
197 assert_routing(
198 { :method => 'get', :path => "/issue_categories/1/edit" },
198 { :method => 'get', :path => "/issue_categories/1/edit" },
199 { :controller => 'issue_categories', :action => 'edit', :id => '1' }
199 { :controller => 'issue_categories', :action => 'edit', :id => '1' }
200 )
200 )
201 assert_routing(
201 assert_routing(
202 { :method => 'put', :path => "/issue_categories/1" },
202 { :method => 'put', :path => "/issue_categories/1" },
203 { :controller => 'issue_categories', :action => 'update', :id => '1' }
203 { :controller => 'issue_categories', :action => 'update', :id => '1' }
204 )
204 )
205 assert_routing(
205 assert_routing(
206 { :method => 'put', :path => "/issue_categories/1.xml" },
206 { :method => 'put', :path => "/issue_categories/1.xml" },
207 { :controller => 'issue_categories', :action => 'update', :id => '1',
207 { :controller => 'issue_categories', :action => 'update', :id => '1',
208 :format => 'xml' }
208 :format => 'xml' }
209 )
209 )
210 assert_routing(
210 assert_routing(
211 { :method => 'put', :path => "/issue_categories/1.json" },
211 { :method => 'put', :path => "/issue_categories/1.json" },
212 { :controller => 'issue_categories', :action => 'update', :id => '1',
212 { :controller => 'issue_categories', :action => 'update', :id => '1',
213 :format => 'json' }
213 :format => 'json' }
214 )
214 )
215 assert_routing(
215 assert_routing(
216 { :method => 'delete', :path => "/issue_categories/1" },
216 { :method => 'delete', :path => "/issue_categories/1" },
217 { :controller => 'issue_categories', :action => 'destroy', :id => '1' }
217 { :controller => 'issue_categories', :action => 'destroy', :id => '1' }
218 )
218 )
219 assert_routing(
219 assert_routing(
220 { :method => 'delete', :path => "/issue_categories/1.xml" },
220 { :method => 'delete', :path => "/issue_categories/1.xml" },
221 { :controller => 'issue_categories', :action => 'destroy', :id => '1',
221 { :controller => 'issue_categories', :action => 'destroy', :id => '1',
222 :format => 'xml' }
222 :format => 'xml' }
223 )
223 )
224 assert_routing(
224 assert_routing(
225 { :method => 'delete', :path => "/issue_categories/1.json" },
225 { :method => 'delete', :path => "/issue_categories/1.json" },
226 { :controller => 'issue_categories', :action => 'destroy', :id => '1',
226 { :controller => 'issue_categories', :action => 'destroy', :id => '1',
227 :format => 'json' }
227 :format => 'json' }
228 )
228 )
229 end
229 end
230
230
231 def test_members
232 assert_routing(
233 { :method => 'post', :path => "/projects/5234/members/new" },
234 { :controller => 'members', :action => 'new', :id => '5234' }
235 )
236 end
237
238 def test_news
231 def test_news
239 assert_routing(
232 assert_routing(
240 { :method => 'get', :path => "/news" },
233 { :method => 'get', :path => "/news" },
241 { :controller => 'news', :action => 'index' }
234 { :controller => 'news', :action => 'index' }
242 )
235 )
243 assert_routing(
236 assert_routing(
244 { :method => 'get', :path => "/news.atom" },
237 { :method => 'get', :path => "/news.atom" },
245 { :controller => 'news', :action => 'index', :format => 'atom' }
238 { :controller => 'news', :action => 'index', :format => 'atom' }
246 )
239 )
247 assert_routing(
240 assert_routing(
248 { :method => 'get', :path => "/news.xml" },
241 { :method => 'get', :path => "/news.xml" },
249 { :controller => 'news', :action => 'index', :format => 'xml' }
242 { :controller => 'news', :action => 'index', :format => 'xml' }
250 )
243 )
251 assert_routing(
244 assert_routing(
252 { :method => 'get', :path => "/news.json" },
245 { :method => 'get', :path => "/news.json" },
253 { :controller => 'news', :action => 'index', :format => 'json' }
246 { :controller => 'news', :action => 'index', :format => 'json' }
254 )
247 )
255 assert_routing(
248 assert_routing(
256 { :method => 'get', :path => "/projects/567/news" },
249 { :method => 'get', :path => "/projects/567/news" },
257 { :controller => 'news', :action => 'index', :project_id => '567' }
250 { :controller => 'news', :action => 'index', :project_id => '567' }
258 )
251 )
259 assert_routing(
252 assert_routing(
260 { :method => 'get', :path => "/projects/567/news.atom" },
253 { :method => 'get', :path => "/projects/567/news.atom" },
261 { :controller => 'news', :action => 'index', :format => 'atom',
254 { :controller => 'news', :action => 'index', :format => 'atom',
262 :project_id => '567' }
255 :project_id => '567' }
263 )
256 )
264 assert_routing(
257 assert_routing(
265 { :method => 'get', :path => "/projects/567/news.xml" },
258 { :method => 'get', :path => "/projects/567/news.xml" },
266 { :controller => 'news', :action => 'index', :format => 'xml',
259 { :controller => 'news', :action => 'index', :format => 'xml',
267 :project_id => '567' }
260 :project_id => '567' }
268 )
261 )
269 assert_routing(
262 assert_routing(
270 { :method => 'get', :path => "/projects/567/news.json" },
263 { :method => 'get', :path => "/projects/567/news.json" },
271 { :controller => 'news', :action => 'index', :format => 'json',
264 { :controller => 'news', :action => 'index', :format => 'json',
272 :project_id => '567' }
265 :project_id => '567' }
273 )
266 )
274 assert_routing(
267 assert_routing(
275 { :method => 'get', :path => "/news/2" },
268 { :method => 'get', :path => "/news/2" },
276 { :controller => 'news', :action => 'show', :id => '2' }
269 { :controller => 'news', :action => 'show', :id => '2' }
277 )
270 )
278 assert_routing(
271 assert_routing(
279 { :method => 'get', :path => "/projects/567/news/new" },
272 { :method => 'get', :path => "/projects/567/news/new" },
280 { :controller => 'news', :action => 'new', :project_id => '567' }
273 { :controller => 'news', :action => 'new', :project_id => '567' }
281 )
274 )
282 assert_routing(
275 assert_routing(
283 { :method => 'get', :path => "/news/234" },
276 { :method => 'get', :path => "/news/234" },
284 { :controller => 'news', :action => 'show', :id => '234' }
277 { :controller => 'news', :action => 'show', :id => '234' }
285 )
278 )
286 assert_routing(
279 assert_routing(
287 { :method => 'get', :path => "/news/567/edit" },
280 { :method => 'get', :path => "/news/567/edit" },
288 { :controller => 'news', :action => 'edit', :id => '567' }
281 { :controller => 'news', :action => 'edit', :id => '567' }
289 )
282 )
290 assert_routing(
283 assert_routing(
291 { :method => 'get', :path => "/news/preview" },
284 { :method => 'get', :path => "/news/preview" },
292 { :controller => 'previews', :action => 'news' }
285 { :controller => 'previews', :action => 'news' }
293 )
286 )
294 assert_routing(
287 assert_routing(
295 { :method => 'post', :path => "/projects/567/news" },
288 { :method => 'post', :path => "/projects/567/news" },
296 { :controller => 'news', :action => 'create', :project_id => '567' }
289 { :controller => 'news', :action => 'create', :project_id => '567' }
297 )
290 )
298 assert_routing(
291 assert_routing(
299 { :method => 'post', :path => "/news/567/comments" },
292 { :method => 'post', :path => "/news/567/comments" },
300 { :controller => 'comments', :action => 'create', :id => '567' }
293 { :controller => 'comments', :action => 'create', :id => '567' }
301 )
294 )
302 assert_routing(
295 assert_routing(
303 { :method => 'put', :path => "/news/567" },
296 { :method => 'put', :path => "/news/567" },
304 { :controller => 'news', :action => 'update', :id => '567' }
297 { :controller => 'news', :action => 'update', :id => '567' }
305 )
298 )
306 assert_routing(
299 assert_routing(
307 { :method => 'delete', :path => "/news/567" },
300 { :method => 'delete', :path => "/news/567" },
308 { :controller => 'news', :action => 'destroy', :id => '567' }
301 { :controller => 'news', :action => 'destroy', :id => '567' }
309 )
302 )
310 assert_routing(
303 assert_routing(
311 { :method => 'delete', :path => "/news/567/comments/15" },
304 { :method => 'delete', :path => "/news/567/comments/15" },
312 { :controller => 'comments', :action => 'destroy', :id => '567',
305 { :controller => 'comments', :action => 'destroy', :id => '567',
313 :comment_id => '15' }
306 :comment_id => '15' }
314 )
307 )
315 end
308 end
316
309
317 def test_projects
310 def test_projects
318 assert_routing(
311 assert_routing(
319 { :method => 'get', :path => "/projects" },
312 { :method => 'get', :path => "/projects" },
320 { :controller => 'projects', :action => 'index' }
313 { :controller => 'projects', :action => 'index' }
321 )
314 )
322 assert_routing(
315 assert_routing(
323 { :method => 'get', :path => "/projects.atom" },
316 { :method => 'get', :path => "/projects.atom" },
324 { :controller => 'projects', :action => 'index', :format => 'atom' }
317 { :controller => 'projects', :action => 'index', :format => 'atom' }
325 )
318 )
326 assert_routing(
319 assert_routing(
327 { :method => 'get', :path => "/projects.xml" },
320 { :method => 'get', :path => "/projects.xml" },
328 { :controller => 'projects', :action => 'index', :format => 'xml' }
321 { :controller => 'projects', :action => 'index', :format => 'xml' }
329 )
322 )
330 assert_routing(
323 assert_routing(
331 { :method => 'get', :path => "/projects/new" },
324 { :method => 'get', :path => "/projects/new" },
332 { :controller => 'projects', :action => 'new' }
325 { :controller => 'projects', :action => 'new' }
333 )
326 )
334 assert_routing(
327 assert_routing(
335 { :method => 'get', :path => "/projects/test" },
328 { :method => 'get', :path => "/projects/test" },
336 { :controller => 'projects', :action => 'show', :id => 'test' }
329 { :controller => 'projects', :action => 'show', :id => 'test' }
337 )
330 )
338 assert_routing(
331 assert_routing(
339 { :method => 'get', :path => "/projects/1.xml" },
332 { :method => 'get', :path => "/projects/1.xml" },
340 { :controller => 'projects', :action => 'show', :id => '1',
333 { :controller => 'projects', :action => 'show', :id => '1',
341 :format => 'xml' }
334 :format => 'xml' }
342 )
335 )
343 assert_routing(
336 assert_routing(
344 { :method => 'get', :path => "/projects/4223/settings" },
337 { :method => 'get', :path => "/projects/4223/settings" },
345 { :controller => 'projects', :action => 'settings', :id => '4223' }
338 { :controller => 'projects', :action => 'settings', :id => '4223' }
346 )
339 )
347 assert_routing(
340 assert_routing(
348 { :method => 'get', :path => "/projects/4223/settings/members" },
341 { :method => 'get', :path => "/projects/4223/settings/members" },
349 { :controller => 'projects', :action => 'settings', :id => '4223',
342 { :controller => 'projects', :action => 'settings', :id => '4223',
350 :tab => 'members' }
343 :tab => 'members' }
351 )
344 )
352 assert_routing(
345 assert_routing(
353 { :method => 'get', :path => "/projects/33/roadmap" },
346 { :method => 'get', :path => "/projects/33/roadmap" },
354 { :controller => 'versions', :action => 'index', :project_id => '33' }
347 { :controller => 'versions', :action => 'index', :project_id => '33' }
355 )
348 )
356 assert_routing(
349 assert_routing(
357 { :method => 'get', :path => "/projects/33/activity" },
350 { :method => 'get', :path => "/projects/33/activity" },
358 { :controller => 'activities', :action => 'index', :id => '33' }
351 { :controller => 'activities', :action => 'index', :id => '33' }
359 )
352 )
360 assert_routing(
353 assert_routing(
361 { :method => 'get', :path => "/projects/33/activity.atom" },
354 { :method => 'get', :path => "/projects/33/activity.atom" },
362 { :controller => 'activities', :action => 'index', :id => '33',
355 { :controller => 'activities', :action => 'index', :id => '33',
363 :format => 'atom' }
356 :format => 'atom' }
364 )
357 )
365 assert_routing(
358 assert_routing(
366 { :method => 'post', :path => "/projects" },
359 { :method => 'post', :path => "/projects" },
367 { :controller => 'projects', :action => 'create' }
360 { :controller => 'projects', :action => 'create' }
368 )
361 )
369 assert_routing(
362 assert_routing(
370 { :method => 'post', :path => "/projects.xml" },
363 { :method => 'post', :path => "/projects.xml" },
371 { :controller => 'projects', :action => 'create', :format => 'xml' }
364 { :controller => 'projects', :action => 'create', :format => 'xml' }
372 )
365 )
373 assert_routing(
366 assert_routing(
374 { :method => 'post', :path => "/projects/64/archive" },
367 { :method => 'post', :path => "/projects/64/archive" },
375 { :controller => 'projects', :action => 'archive', :id => '64' }
368 { :controller => 'projects', :action => 'archive', :id => '64' }
376 )
369 )
377 assert_routing(
370 assert_routing(
378 { :method => 'post', :path => "/projects/64/unarchive" },
371 { :method => 'post', :path => "/projects/64/unarchive" },
379 { :controller => 'projects', :action => 'unarchive', :id => '64' }
372 { :controller => 'projects', :action => 'unarchive', :id => '64' }
380 )
373 )
381 assert_routing(
374 assert_routing(
382 { :method => 'put', :path => "/projects/64/enumerations" },
375 { :method => 'put', :path => "/projects/64/enumerations" },
383 { :controller => 'project_enumerations', :action => 'update',
376 { :controller => 'project_enumerations', :action => 'update',
384 :project_id => '64' }
377 :project_id => '64' }
385 )
378 )
386 assert_routing(
379 assert_routing(
387 { :method => 'put', :path => "/projects/4223" },
380 { :method => 'put', :path => "/projects/4223" },
388 { :controller => 'projects', :action => 'update', :id => '4223' }
381 { :controller => 'projects', :action => 'update', :id => '4223' }
389 )
382 )
390 assert_routing(
383 assert_routing(
391 { :method => 'put', :path => "/projects/1.xml" },
384 { :method => 'put', :path => "/projects/1.xml" },
392 { :controller => 'projects', :action => 'update', :id => '1',
385 { :controller => 'projects', :action => 'update', :id => '1',
393 :format => 'xml' }
386 :format => 'xml' }
394 )
387 )
395 assert_routing(
388 assert_routing(
396 { :method => 'delete', :path => "/projects/64" },
389 { :method => 'delete', :path => "/projects/64" },
397 { :controller => 'projects', :action => 'destroy', :id => '64' }
390 { :controller => 'projects', :action => 'destroy', :id => '64' }
398 )
391 )
399 assert_routing(
392 assert_routing(
400 { :method => 'delete', :path => "/projects/1.xml" },
393 { :method => 'delete', :path => "/projects/1.xml" },
401 { :controller => 'projects', :action => 'destroy', :id => '1',
394 { :controller => 'projects', :action => 'destroy', :id => '1',
402 :format => 'xml' }
395 :format => 'xml' }
403 )
396 )
404 assert_routing(
397 assert_routing(
405 { :method => 'delete', :path => "/projects/64/enumerations" },
398 { :method => 'delete', :path => "/projects/64/enumerations" },
406 { :controller => 'project_enumerations', :action => 'destroy',
399 { :controller => 'project_enumerations', :action => 'destroy',
407 :project_id => '64' }
400 :project_id => '64' }
408 )
401 )
409 end
402 end
410
403
411 def test_queries
404 def test_queries
412 assert_routing(
405 assert_routing(
413 { :method => 'get', :path => "/queries.xml" },
406 { :method => 'get', :path => "/queries.xml" },
414 { :controller => 'queries', :action => 'index', :format => 'xml' }
407 { :controller => 'queries', :action => 'index', :format => 'xml' }
415 )
408 )
416 assert_routing(
409 assert_routing(
417 { :method => 'get', :path => "/queries.json" },
410 { :method => 'get', :path => "/queries.json" },
418 { :controller => 'queries', :action => 'index', :format => 'json' }
411 { :controller => 'queries', :action => 'index', :format => 'json' }
419 )
412 )
420 assert_routing(
413 assert_routing(
421 { :method => 'get', :path => "/queries/new" },
414 { :method => 'get', :path => "/queries/new" },
422 { :controller => 'queries', :action => 'new' }
415 { :controller => 'queries', :action => 'new' }
423 )
416 )
424 assert_routing(
417 assert_routing(
425 { :method => 'get', :path => "/projects/redmine/queries/new" },
418 { :method => 'get', :path => "/projects/redmine/queries/new" },
426 { :controller => 'queries', :action => 'new', :project_id => 'redmine' }
419 { :controller => 'queries', :action => 'new', :project_id => 'redmine' }
427 )
420 )
428 assert_routing(
421 assert_routing(
429 { :method => 'post', :path => "/queries" },
422 { :method => 'post', :path => "/queries" },
430 { :controller => 'queries', :action => 'create' }
423 { :controller => 'queries', :action => 'create' }
431 )
424 )
432 assert_routing(
425 assert_routing(
433 { :method => 'post', :path => "/projects/redmine/queries" },
426 { :method => 'post', :path => "/projects/redmine/queries" },
434 { :controller => 'queries', :action => 'create', :project_id => 'redmine' }
427 { :controller => 'queries', :action => 'create', :project_id => 'redmine' }
435 )
428 )
436 assert_routing(
429 assert_routing(
437 { :method => 'get', :path => "/queries/1/edit" },
430 { :method => 'get', :path => "/queries/1/edit" },
438 { :controller => 'queries', :action => 'edit', :id => '1' }
431 { :controller => 'queries', :action => 'edit', :id => '1' }
439 )
432 )
440 assert_routing(
433 assert_routing(
441 { :method => 'put', :path => "/queries/1" },
434 { :method => 'put', :path => "/queries/1" },
442 { :controller => 'queries', :action => 'update', :id => '1' }
435 { :controller => 'queries', :action => 'update', :id => '1' }
443 )
436 )
444 assert_routing(
437 assert_routing(
445 { :method => 'delete', :path => "/queries/1" },
438 { :method => 'delete', :path => "/queries/1" },
446 { :controller => 'queries', :action => 'destroy', :id => '1' }
439 { :controller => 'queries', :action => 'destroy', :id => '1' }
447 )
440 )
448 end
441 end
449
442
450 def test_roles
443 def test_roles
451 assert_routing(
444 assert_routing(
452 { :method => 'get', :path => "/roles" },
445 { :method => 'get', :path => "/roles" },
453 { :controller => 'roles', :action => 'index' }
446 { :controller => 'roles', :action => 'index' }
454 )
447 )
455 assert_routing(
448 assert_routing(
456 { :method => 'get', :path => "/roles/new" },
449 { :method => 'get', :path => "/roles/new" },
457 { :controller => 'roles', :action => 'new' }
450 { :controller => 'roles', :action => 'new' }
458 )
451 )
459 assert_routing(
452 assert_routing(
460 { :method => 'post', :path => "/roles" },
453 { :method => 'post', :path => "/roles" },
461 { :controller => 'roles', :action => 'create' }
454 { :controller => 'roles', :action => 'create' }
462 )
455 )
463 assert_routing(
456 assert_routing(
464 { :method => 'get', :path => "/roles/2/edit" },
457 { :method => 'get', :path => "/roles/2/edit" },
465 { :controller => 'roles', :action => 'edit', :id => '2' }
458 { :controller => 'roles', :action => 'edit', :id => '2' }
466 )
459 )
467 assert_routing(
460 assert_routing(
468 { :method => 'put', :path => "/roles/2" },
461 { :method => 'put', :path => "/roles/2" },
469 { :controller => 'roles', :action => 'update', :id => '2' }
462 { :controller => 'roles', :action => 'update', :id => '2' }
470 )
463 )
471 assert_routing(
464 assert_routing(
472 { :method => 'delete', :path => "/roles/2" },
465 { :method => 'delete', :path => "/roles/2" },
473 { :controller => 'roles', :action => 'destroy', :id => '2' }
466 { :controller => 'roles', :action => 'destroy', :id => '2' }
474 )
467 )
475 assert_routing(
468 assert_routing(
476 { :method => 'get', :path => "/roles/permissions" },
469 { :method => 'get', :path => "/roles/permissions" },
477 { :controller => 'roles', :action => 'permissions' }
470 { :controller => 'roles', :action => 'permissions' }
478 )
471 )
479 assert_routing(
472 assert_routing(
480 { :method => 'post', :path => "/roles/permissions" },
473 { :method => 'post', :path => "/roles/permissions" },
481 { :controller => 'roles', :action => 'permissions' }
474 { :controller => 'roles', :action => 'permissions' }
482 )
475 )
483 end
476 end
484
477
485 def test_timelogs_global
478 def test_timelogs_global
486 assert_routing(
479 assert_routing(
487 { :method => 'get', :path => "/time_entries" },
480 { :method => 'get', :path => "/time_entries" },
488 { :controller => 'timelog', :action => 'index' }
481 { :controller => 'timelog', :action => 'index' }
489 )
482 )
490 assert_routing(
483 assert_routing(
491 { :method => 'get', :path => "/time_entries.csv" },
484 { :method => 'get', :path => "/time_entries.csv" },
492 { :controller => 'timelog', :action => 'index', :format => 'csv' }
485 { :controller => 'timelog', :action => 'index', :format => 'csv' }
493 )
486 )
494 assert_routing(
487 assert_routing(
495 { :method => 'get', :path => "/time_entries.atom" },
488 { :method => 'get', :path => "/time_entries.atom" },
496 { :controller => 'timelog', :action => 'index', :format => 'atom' }
489 { :controller => 'timelog', :action => 'index', :format => 'atom' }
497 )
490 )
498 assert_routing(
491 assert_routing(
499 { :method => 'get', :path => "/time_entries/new" },
492 { :method => 'get', :path => "/time_entries/new" },
500 { :controller => 'timelog', :action => 'new' }
493 { :controller => 'timelog', :action => 'new' }
501 )
494 )
502 assert_routing(
495 assert_routing(
503 { :method => 'get', :path => "/time_entries/22/edit" },
496 { :method => 'get', :path => "/time_entries/22/edit" },
504 { :controller => 'timelog', :action => 'edit', :id => '22' }
497 { :controller => 'timelog', :action => 'edit', :id => '22' }
505 )
498 )
506 assert_routing(
499 assert_routing(
507 { :method => 'post', :path => "/time_entries" },
500 { :method => 'post', :path => "/time_entries" },
508 { :controller => 'timelog', :action => 'create' }
501 { :controller => 'timelog', :action => 'create' }
509 )
502 )
510 assert_routing(
503 assert_routing(
511 { :method => 'put', :path => "/time_entries/22" },
504 { :method => 'put', :path => "/time_entries/22" },
512 { :controller => 'timelog', :action => 'update', :id => '22' }
505 { :controller => 'timelog', :action => 'update', :id => '22' }
513 )
506 )
514 assert_routing(
507 assert_routing(
515 { :method => 'delete', :path => "/time_entries/55" },
508 { :method => 'delete', :path => "/time_entries/55" },
516 { :controller => 'timelog', :action => 'destroy', :id => '55' }
509 { :controller => 'timelog', :action => 'destroy', :id => '55' }
517 )
510 )
518 end
511 end
519
512
520 def test_timelogs_scoped_under_project
513 def test_timelogs_scoped_under_project
521 assert_routing(
514 assert_routing(
522 { :method => 'get', :path => "/projects/567/time_entries" },
515 { :method => 'get', :path => "/projects/567/time_entries" },
523 { :controller => 'timelog', :action => 'index', :project_id => '567' }
516 { :controller => 'timelog', :action => 'index', :project_id => '567' }
524 )
517 )
525 assert_routing(
518 assert_routing(
526 { :method => 'get', :path => "/projects/567/time_entries.csv" },
519 { :method => 'get', :path => "/projects/567/time_entries.csv" },
527 { :controller => 'timelog', :action => 'index', :project_id => '567',
520 { :controller => 'timelog', :action => 'index', :project_id => '567',
528 :format => 'csv' }
521 :format => 'csv' }
529 )
522 )
530 assert_routing(
523 assert_routing(
531 { :method => 'get', :path => "/projects/567/time_entries.atom" },
524 { :method => 'get', :path => "/projects/567/time_entries.atom" },
532 { :controller => 'timelog', :action => 'index', :project_id => '567',
525 { :controller => 'timelog', :action => 'index', :project_id => '567',
533 :format => 'atom' }
526 :format => 'atom' }
534 )
527 )
535 assert_routing(
528 assert_routing(
536 { :method => 'get', :path => "/projects/567/time_entries/new" },
529 { :method => 'get', :path => "/projects/567/time_entries/new" },
537 { :controller => 'timelog', :action => 'new', :project_id => '567' }
530 { :controller => 'timelog', :action => 'new', :project_id => '567' }
538 )
531 )
539 assert_routing(
532 assert_routing(
540 { :method => 'get', :path => "/projects/567/time_entries/22/edit" },
533 { :method => 'get', :path => "/projects/567/time_entries/22/edit" },
541 { :controller => 'timelog', :action => 'edit',
534 { :controller => 'timelog', :action => 'edit',
542 :id => '22', :project_id => '567' }
535 :id => '22', :project_id => '567' }
543 )
536 )
544 assert_routing(
537 assert_routing(
545 { :method => 'post', :path => "/projects/567/time_entries" },
538 { :method => 'post', :path => "/projects/567/time_entries" },
546 { :controller => 'timelog', :action => 'create',
539 { :controller => 'timelog', :action => 'create',
547 :project_id => '567' }
540 :project_id => '567' }
548 )
541 )
549 assert_routing(
542 assert_routing(
550 { :method => 'put', :path => "/projects/567/time_entries/22" },
543 { :method => 'put', :path => "/projects/567/time_entries/22" },
551 { :controller => 'timelog', :action => 'update',
544 { :controller => 'timelog', :action => 'update',
552 :id => '22', :project_id => '567' }
545 :id => '22', :project_id => '567' }
553 )
546 )
554 assert_routing(
547 assert_routing(
555 { :method => 'delete', :path => "/projects/567/time_entries/55" },
548 { :method => 'delete', :path => "/projects/567/time_entries/55" },
556 { :controller => 'timelog', :action => 'destroy',
549 { :controller => 'timelog', :action => 'destroy',
557 :id => '55', :project_id => '567' }
550 :id => '55', :project_id => '567' }
558 )
551 )
559 end
552 end
560
553
561 def test_timelogs_scoped_under_issues
554 def test_timelogs_scoped_under_issues
562 assert_routing(
555 assert_routing(
563 { :method => 'get', :path => "/issues/234/time_entries" },
556 { :method => 'get', :path => "/issues/234/time_entries" },
564 { :controller => 'timelog', :action => 'index', :issue_id => '234' }
557 { :controller => 'timelog', :action => 'index', :issue_id => '234' }
565 )
558 )
566 assert_routing(
559 assert_routing(
567 { :method => 'get', :path => "/issues/234/time_entries.csv" },
560 { :method => 'get', :path => "/issues/234/time_entries.csv" },
568 { :controller => 'timelog', :action => 'index', :issue_id => '234',
561 { :controller => 'timelog', :action => 'index', :issue_id => '234',
569 :format => 'csv' }
562 :format => 'csv' }
570 )
563 )
571 assert_routing(
564 assert_routing(
572 { :method => 'get', :path => "/issues/234/time_entries.atom" },
565 { :method => 'get', :path => "/issues/234/time_entries.atom" },
573 { :controller => 'timelog', :action => 'index', :issue_id => '234',
566 { :controller => 'timelog', :action => 'index', :issue_id => '234',
574 :format => 'atom' }
567 :format => 'atom' }
575 )
568 )
576 assert_routing(
569 assert_routing(
577 { :method => 'get', :path => "/issues/234/time_entries/new" },
570 { :method => 'get', :path => "/issues/234/time_entries/new" },
578 { :controller => 'timelog', :action => 'new', :issue_id => '234' }
571 { :controller => 'timelog', :action => 'new', :issue_id => '234' }
579 )
572 )
580 assert_routing(
573 assert_routing(
581 { :method => 'get', :path => "/issues/234/time_entries/22/edit" },
574 { :method => 'get', :path => "/issues/234/time_entries/22/edit" },
582 { :controller => 'timelog', :action => 'edit', :id => '22',
575 { :controller => 'timelog', :action => 'edit', :id => '22',
583 :issue_id => '234' }
576 :issue_id => '234' }
584 )
577 )
585 assert_routing(
578 assert_routing(
586 { :method => 'post', :path => "/issues/234/time_entries" },
579 { :method => 'post', :path => "/issues/234/time_entries" },
587 { :controller => 'timelog', :action => 'create', :issue_id => '234' }
580 { :controller => 'timelog', :action => 'create', :issue_id => '234' }
588 )
581 )
589 assert_routing(
582 assert_routing(
590 { :method => 'put', :path => "/issues/234/time_entries/22" },
583 { :method => 'put', :path => "/issues/234/time_entries/22" },
591 { :controller => 'timelog', :action => 'update', :id => '22',
584 { :controller => 'timelog', :action => 'update', :id => '22',
592 :issue_id => '234' }
585 :issue_id => '234' }
593 )
586 )
594 assert_routing(
587 assert_routing(
595 { :method => 'delete', :path => "/issues/234/time_entries/55" },
588 { :method => 'delete', :path => "/issues/234/time_entries/55" },
596 { :controller => 'timelog', :action => 'destroy', :id => '55',
589 { :controller => 'timelog', :action => 'destroy', :id => '55',
597 :issue_id => '234' }
590 :issue_id => '234' }
598 )
591 )
599 end
592 end
600
593
601 def test_timelogs_scoped_under_project_and_issues
594 def test_timelogs_scoped_under_project_and_issues
602 assert_routing(
595 assert_routing(
603 { :method => 'get',
596 { :method => 'get',
604 :path => "/projects/ecookbook/issues/234/time_entries" },
597 :path => "/projects/ecookbook/issues/234/time_entries" },
605 { :controller => 'timelog', :action => 'index',
598 { :controller => 'timelog', :action => 'index',
606 :issue_id => '234', :project_id => 'ecookbook' }
599 :issue_id => '234', :project_id => 'ecookbook' }
607 )
600 )
608 assert_routing(
601 assert_routing(
609 { :method => 'get',
602 { :method => 'get',
610 :path => "/projects/ecookbook/issues/234/time_entries.csv" },
603 :path => "/projects/ecookbook/issues/234/time_entries.csv" },
611 { :controller => 'timelog', :action => 'index',
604 { :controller => 'timelog', :action => 'index',
612 :issue_id => '234', :project_id => 'ecookbook', :format => 'csv' }
605 :issue_id => '234', :project_id => 'ecookbook', :format => 'csv' }
613 )
606 )
614 assert_routing(
607 assert_routing(
615 { :method => 'get',
608 { :method => 'get',
616 :path => "/projects/ecookbook/issues/234/time_entries.atom" },
609 :path => "/projects/ecookbook/issues/234/time_entries.atom" },
617 { :controller => 'timelog', :action => 'index',
610 { :controller => 'timelog', :action => 'index',
618 :issue_id => '234', :project_id => 'ecookbook', :format => 'atom' }
611 :issue_id => '234', :project_id => 'ecookbook', :format => 'atom' }
619 )
612 )
620 assert_routing(
613 assert_routing(
621 { :method => 'get',
614 { :method => 'get',
622 :path => "/projects/ecookbook/issues/234/time_entries/new" },
615 :path => "/projects/ecookbook/issues/234/time_entries/new" },
623 { :controller => 'timelog', :action => 'new',
616 { :controller => 'timelog', :action => 'new',
624 :issue_id => '234', :project_id => 'ecookbook' }
617 :issue_id => '234', :project_id => 'ecookbook' }
625 )
618 )
626 assert_routing(
619 assert_routing(
627 { :method => 'get',
620 { :method => 'get',
628 :path => "/projects/ecookbook/issues/234/time_entries/22/edit" },
621 :path => "/projects/ecookbook/issues/234/time_entries/22/edit" },
629 { :controller => 'timelog', :action => 'edit', :id => '22',
622 { :controller => 'timelog', :action => 'edit', :id => '22',
630 :issue_id => '234', :project_id => 'ecookbook' }
623 :issue_id => '234', :project_id => 'ecookbook' }
631 )
624 )
632 assert_routing(
625 assert_routing(
633 { :method => 'post',
626 { :method => 'post',
634 :path => "/projects/ecookbook/issues/234/time_entries" },
627 :path => "/projects/ecookbook/issues/234/time_entries" },
635 { :controller => 'timelog', :action => 'create',
628 { :controller => 'timelog', :action => 'create',
636 :issue_id => '234', :project_id => 'ecookbook' }
629 :issue_id => '234', :project_id => 'ecookbook' }
637 )
630 )
638 assert_routing(
631 assert_routing(
639 { :method => 'put',
632 { :method => 'put',
640 :path => "/projects/ecookbook/issues/234/time_entries/22" },
633 :path => "/projects/ecookbook/issues/234/time_entries/22" },
641 { :controller => 'timelog', :action => 'update', :id => '22',
634 { :controller => 'timelog', :action => 'update', :id => '22',
642 :issue_id => '234', :project_id => 'ecookbook' }
635 :issue_id => '234', :project_id => 'ecookbook' }
643 )
636 )
644 assert_routing(
637 assert_routing(
645 { :method => 'delete',
638 { :method => 'delete',
646 :path => "/projects/ecookbook/issues/234/time_entries/55" },
639 :path => "/projects/ecookbook/issues/234/time_entries/55" },
647 { :controller => 'timelog', :action => 'destroy', :id => '55',
640 { :controller => 'timelog', :action => 'destroy', :id => '55',
648 :issue_id => '234', :project_id => 'ecookbook' }
641 :issue_id => '234', :project_id => 'ecookbook' }
649 )
642 )
650 assert_routing(
643 assert_routing(
651 { :method => 'get',
644 { :method => 'get',
652 :path => "/time_entries/report" },
645 :path => "/time_entries/report" },
653 { :controller => 'timelog', :action => 'report' }
646 { :controller => 'timelog', :action => 'report' }
654 )
647 )
655 assert_routing(
648 assert_routing(
656 { :method => 'get',
649 { :method => 'get',
657 :path => "/projects/567/time_entries/report" },
650 :path => "/projects/567/time_entries/report" },
658 { :controller => 'timelog', :action => 'report', :project_id => '567' }
651 { :controller => 'timelog', :action => 'report', :project_id => '567' }
659 )
652 )
660 assert_routing(
653 assert_routing(
661 { :method => 'get',
654 { :method => 'get',
662 :path => "/projects/567/time_entries/report.csv" },
655 :path => "/projects/567/time_entries/report.csv" },
663 { :controller => 'timelog', :action => 'report', :project_id => '567',
656 { :controller => 'timelog', :action => 'report', :project_id => '567',
664 :format => 'csv' }
657 :format => 'csv' }
665 )
658 )
666 end
659 end
667
660
668 def test_users
661 def test_users
669 assert_routing(
662 assert_routing(
670 { :method => 'get', :path => "/users" },
663 { :method => 'get', :path => "/users" },
671 { :controller => 'users', :action => 'index' }
664 { :controller => 'users', :action => 'index' }
672 )
665 )
673 assert_routing(
666 assert_routing(
674 { :method => 'get', :path => "/users.xml" },
667 { :method => 'get', :path => "/users.xml" },
675 { :controller => 'users', :action => 'index', :format => 'xml' }
668 { :controller => 'users', :action => 'index', :format => 'xml' }
676 )
669 )
677 assert_routing(
670 assert_routing(
678 { :method => 'get', :path => "/users/44" },
671 { :method => 'get', :path => "/users/44" },
679 { :controller => 'users', :action => 'show', :id => '44' }
672 { :controller => 'users', :action => 'show', :id => '44' }
680 )
673 )
681 assert_routing(
674 assert_routing(
682 { :method => 'get', :path => "/users/44.xml" },
675 { :method => 'get', :path => "/users/44.xml" },
683 { :controller => 'users', :action => 'show', :id => '44',
676 { :controller => 'users', :action => 'show', :id => '44',
684 :format => 'xml' }
677 :format => 'xml' }
685 )
678 )
686 assert_routing(
679 assert_routing(
687 { :method => 'get', :path => "/users/current" },
680 { :method => 'get', :path => "/users/current" },
688 { :controller => 'users', :action => 'show', :id => 'current' }
681 { :controller => 'users', :action => 'show', :id => 'current' }
689 )
682 )
690 assert_routing(
683 assert_routing(
691 { :method => 'get', :path => "/users/current.xml" },
684 { :method => 'get', :path => "/users/current.xml" },
692 { :controller => 'users', :action => 'show', :id => 'current',
685 { :controller => 'users', :action => 'show', :id => 'current',
693 :format => 'xml' }
686 :format => 'xml' }
694 )
687 )
695 assert_routing(
688 assert_routing(
696 { :method => 'get', :path => "/users/new" },
689 { :method => 'get', :path => "/users/new" },
697 { :controller => 'users', :action => 'new' }
690 { :controller => 'users', :action => 'new' }
698 )
691 )
699 assert_routing(
692 assert_routing(
700 { :method => 'get', :path => "/users/444/edit" },
693 { :method => 'get', :path => "/users/444/edit" },
701 { :controller => 'users', :action => 'edit', :id => '444' }
694 { :controller => 'users', :action => 'edit', :id => '444' }
702 )
695 )
703 assert_routing(
696 assert_routing(
704 { :method => 'post', :path => "/users" },
697 { :method => 'post', :path => "/users" },
705 { :controller => 'users', :action => 'create' }
698 { :controller => 'users', :action => 'create' }
706 )
699 )
707 assert_routing(
700 assert_routing(
708 { :method => 'post', :path => "/users.xml" },
701 { :method => 'post', :path => "/users.xml" },
709 { :controller => 'users', :action => 'create', :format => 'xml' }
702 { :controller => 'users', :action => 'create', :format => 'xml' }
710 )
703 )
711 assert_routing(
704 assert_routing(
712 { :method => 'put', :path => "/users/444" },
705 { :method => 'put', :path => "/users/444" },
713 { :controller => 'users', :action => 'update', :id => '444' }
706 { :controller => 'users', :action => 'update', :id => '444' }
714 )
707 )
715 assert_routing(
708 assert_routing(
716 { :method => 'put', :path => "/users/444.xml" },
709 { :method => 'put', :path => "/users/444.xml" },
717 { :controller => 'users', :action => 'update', :id => '444',
710 { :controller => 'users', :action => 'update', :id => '444',
718 :format => 'xml' }
711 :format => 'xml' }
719 )
712 )
720 assert_routing(
713 assert_routing(
721 { :method => 'delete', :path => "/users/44" },
714 { :method => 'delete', :path => "/users/44" },
722 { :controller => 'users', :action => 'destroy', :id => '44' }
715 { :controller => 'users', :action => 'destroy', :id => '44' }
723 )
716 )
724 assert_routing(
717 assert_routing(
725 { :method => 'delete', :path => "/users/44.xml" },
718 { :method => 'delete', :path => "/users/44.xml" },
726 { :controller => 'users', :action => 'destroy', :id => '44',
719 { :controller => 'users', :action => 'destroy', :id => '44',
727 :format => 'xml' }
720 :format => 'xml' }
728 )
721 )
729 assert_routing(
722 assert_routing(
730 { :method => 'post', :path => "/users/123/memberships" },
723 { :method => 'post', :path => "/users/123/memberships" },
731 { :controller => 'users', :action => 'edit_membership',
724 { :controller => 'users', :action => 'edit_membership',
732 :id => '123' }
725 :id => '123' }
733 )
726 )
734 assert_routing(
727 assert_routing(
735 { :method => 'put', :path => "/users/123/memberships/55" },
728 { :method => 'put', :path => "/users/123/memberships/55" },
736 { :controller => 'users', :action => 'edit_membership',
729 { :controller => 'users', :action => 'edit_membership',
737 :id => '123', :membership_id => '55' }
730 :id => '123', :membership_id => '55' }
738 )
731 )
739 assert_routing(
732 assert_routing(
740 { :method => 'delete', :path => "/users/123/memberships/55" },
733 { :method => 'delete', :path => "/users/123/memberships/55" },
741 { :controller => 'users', :action => 'destroy_membership',
734 { :controller => 'users', :action => 'destroy_membership',
742 :id => '123', :membership_id => '55' }
735 :id => '123', :membership_id => '55' }
743 )
736 )
744 end
737 end
745
738
746 def test_welcome
739 def test_welcome
747 assert_routing(
740 assert_routing(
748 { :method => 'get', :path => "/robots.txt" },
741 { :method => 'get', :path => "/robots.txt" },
749 { :controller => 'welcome', :action => 'robots' }
742 { :controller => 'welcome', :action => 'robots' }
750 )
743 )
751 end
744 end
752
745
753 def test_wiki_singular_projects_pages
746 def test_wiki_singular_projects_pages
754 assert_routing(
747 assert_routing(
755 { :method => 'get', :path => "/projects/567/wiki" },
748 { :method => 'get', :path => "/projects/567/wiki" },
756 { :controller => 'wiki', :action => 'show', :project_id => '567' }
749 { :controller => 'wiki', :action => 'show', :project_id => '567' }
757 )
750 )
758 assert_routing(
751 assert_routing(
759 { :method => 'get', :path => "/projects/567/wiki/lalala" },
752 { :method => 'get', :path => "/projects/567/wiki/lalala" },
760 { :controller => 'wiki', :action => 'show', :project_id => '567',
753 { :controller => 'wiki', :action => 'show', :project_id => '567',
761 :id => 'lalala' }
754 :id => 'lalala' }
762 )
755 )
763 assert_routing(
756 assert_routing(
764 { :method => 'get', :path => "/projects/567/wiki/my_page/edit" },
757 { :method => 'get', :path => "/projects/567/wiki/my_page/edit" },
765 { :controller => 'wiki', :action => 'edit', :project_id => '567',
758 { :controller => 'wiki', :action => 'edit', :project_id => '567',
766 :id => 'my_page' }
759 :id => 'my_page' }
767 )
760 )
768 assert_routing(
761 assert_routing(
769 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/history" },
762 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/history" },
770 { :controller => 'wiki', :action => 'history', :project_id => '1',
763 { :controller => 'wiki', :action => 'history', :project_id => '1',
771 :id => 'CookBook_documentation' }
764 :id => 'CookBook_documentation' }
772 )
765 )
773 assert_routing(
766 assert_routing(
774 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff" },
767 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff" },
775 { :controller => 'wiki', :action => 'diff', :project_id => '1',
768 { :controller => 'wiki', :action => 'diff', :project_id => '1',
776 :id => 'CookBook_documentation' }
769 :id => 'CookBook_documentation' }
777 )
770 )
778 assert_routing(
771 assert_routing(
779 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2" },
772 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2" },
780 { :controller => 'wiki', :action => 'diff', :project_id => '1',
773 { :controller => 'wiki', :action => 'diff', :project_id => '1',
781 :id => 'CookBook_documentation', :version => '2' }
774 :id => 'CookBook_documentation', :version => '2' }
782 )
775 )
783 assert_routing(
776 assert_routing(
784 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2/vs/1" },
777 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2/vs/1" },
785 { :controller => 'wiki', :action => 'diff', :project_id => '1',
778 { :controller => 'wiki', :action => 'diff', :project_id => '1',
786 :id => 'CookBook_documentation', :version => '2', :version_from => '1' }
779 :id => 'CookBook_documentation', :version => '2', :version_from => '1' }
787 )
780 )
788 assert_routing(
781 assert_routing(
789 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/annotate/2" },
782 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/annotate/2" },
790 { :controller => 'wiki', :action => 'annotate', :project_id => '1',
783 { :controller => 'wiki', :action => 'annotate', :project_id => '1',
791 :id => 'CookBook_documentation', :version => '2' }
784 :id => 'CookBook_documentation', :version => '2' }
792 )
785 )
793 assert_routing(
786 assert_routing(
794 { :method => 'get', :path => "/projects/22/wiki/ladida/rename" },
787 { :method => 'get', :path => "/projects/22/wiki/ladida/rename" },
795 { :controller => 'wiki', :action => 'rename', :project_id => '22',
788 { :controller => 'wiki', :action => 'rename', :project_id => '22',
796 :id => 'ladida' }
789 :id => 'ladida' }
797 )
790 )
798 assert_routing(
791 assert_routing(
799 { :method => 'get', :path => "/projects/567/wiki/index" },
792 { :method => 'get', :path => "/projects/567/wiki/index" },
800 { :controller => 'wiki', :action => 'index', :project_id => '567' }
793 { :controller => 'wiki', :action => 'index', :project_id => '567' }
801 )
794 )
802 assert_routing(
795 assert_routing(
803 { :method => 'get', :path => "/projects/567/wiki/date_index" },
796 { :method => 'get', :path => "/projects/567/wiki/date_index" },
804 { :controller => 'wiki', :action => 'date_index', :project_id => '567' }
797 { :controller => 'wiki', :action => 'date_index', :project_id => '567' }
805 )
798 )
806 assert_routing(
799 assert_routing(
807 { :method => 'get', :path => "/projects/567/wiki/export" },
800 { :method => 'get', :path => "/projects/567/wiki/export" },
808 { :controller => 'wiki', :action => 'export', :project_id => '567' }
801 { :controller => 'wiki', :action => 'export', :project_id => '567' }
809 )
802 )
810 assert_routing(
803 assert_routing(
811 { :method => 'post', :path => "/projects/567/wiki/CookBook_documentation/preview" },
804 { :method => 'post', :path => "/projects/567/wiki/CookBook_documentation/preview" },
812 { :controller => 'wiki', :action => 'preview', :project_id => '567',
805 { :controller => 'wiki', :action => 'preview', :project_id => '567',
813 :id => 'CookBook_documentation' }
806 :id => 'CookBook_documentation' }
814 )
807 )
815 assert_routing(
808 assert_routing(
816 { :method => 'post', :path => "/projects/22/wiki/ladida/rename" },
809 { :method => 'post', :path => "/projects/22/wiki/ladida/rename" },
817 { :controller => 'wiki', :action => 'rename', :project_id => '22',
810 { :controller => 'wiki', :action => 'rename', :project_id => '22',
818 :id => 'ladida' }
811 :id => 'ladida' }
819 )
812 )
820 assert_routing(
813 assert_routing(
821 { :method => 'post', :path => "/projects/22/wiki/ladida/protect" },
814 { :method => 'post', :path => "/projects/22/wiki/ladida/protect" },
822 { :controller => 'wiki', :action => 'protect', :project_id => '22',
815 { :controller => 'wiki', :action => 'protect', :project_id => '22',
823 :id => 'ladida' }
816 :id => 'ladida' }
824 )
817 )
825 assert_routing(
818 assert_routing(
826 { :method => 'post', :path => "/projects/22/wiki/ladida/add_attachment" },
819 { :method => 'post', :path => "/projects/22/wiki/ladida/add_attachment" },
827 { :controller => 'wiki', :action => 'add_attachment', :project_id => '22',
820 { :controller => 'wiki', :action => 'add_attachment', :project_id => '22',
828 :id => 'ladida' }
821 :id => 'ladida' }
829 )
822 )
830 assert_routing(
823 assert_routing(
831 { :method => 'put', :path => "/projects/567/wiki/my_page" },
824 { :method => 'put', :path => "/projects/567/wiki/my_page" },
832 { :controller => 'wiki', :action => 'update', :project_id => '567',
825 { :controller => 'wiki', :action => 'update', :project_id => '567',
833 :id => 'my_page' }
826 :id => 'my_page' }
834 )
827 )
835 assert_routing(
828 assert_routing(
836 { :method => 'delete', :path => "/projects/22/wiki/ladida" },
829 { :method => 'delete', :path => "/projects/22/wiki/ladida" },
837 { :controller => 'wiki', :action => 'destroy', :project_id => '22',
830 { :controller => 'wiki', :action => 'destroy', :project_id => '22',
838 :id => 'ladida' }
831 :id => 'ladida' }
839 )
832 )
840 end
833 end
841
834
842 def test_wikis_plural_admin_setup
835 def test_wikis_plural_admin_setup
843 assert_routing(
836 assert_routing(
844 { :method => 'get', :path => "/projects/ladida/wiki/destroy" },
837 { :method => 'get', :path => "/projects/ladida/wiki/destroy" },
845 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
838 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
846 )
839 )
847 assert_routing(
840 assert_routing(
848 { :method => 'post', :path => "/projects/ladida/wiki" },
841 { :method => 'post', :path => "/projects/ladida/wiki" },
849 { :controller => 'wikis', :action => 'edit', :id => 'ladida' }
842 { :controller => 'wikis', :action => 'edit', :id => 'ladida' }
850 )
843 )
851 assert_routing(
844 assert_routing(
852 { :method => 'post', :path => "/projects/ladida/wiki/destroy" },
845 { :method => 'post', :path => "/projects/ladida/wiki/destroy" },
853 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
846 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
854 )
847 )
855 end
848 end
856 end
849 end
General Comments 0
You need to be logged in to leave comments. Login now