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