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