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