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