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