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