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