##// END OF EJS Templates
test: route: move versions test to new file...
Toshi MARUYAMA -
r8219:ceaaf6d3a27a
parent child
Show More
@@ -0,0 +1,109
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 RoutingVersionsTest < ActionController::IntegrationTest
21 def test_versions
22 # /projects/foo/versions is /projects/foo/roadmap
23 assert_routing(
24 { :method => 'get', :path => "/projects/foo/versions.xml" },
25 { :controller => 'versions', :action => 'index',
26 :project_id => 'foo', :format => 'xml' }
27 )
28 assert_routing(
29 { :method => 'get', :path => "/projects/foo/versions.json" },
30 { :controller => 'versions', :action => 'index',
31 :project_id => 'foo', :format => 'json' }
32 )
33 assert_routing(
34 { :method => 'get', :path => "/projects/foo/versions/new" },
35 { :controller => 'versions', :action => 'new',
36 :project_id => 'foo' }
37 )
38 assert_routing(
39 { :method => 'post', :path => "/projects/foo/versions" },
40 { :controller => 'versions', :action => 'create',
41 :project_id => 'foo' }
42 )
43 assert_routing(
44 { :method => 'post', :path => "/projects/foo/versions.xml" },
45 { :controller => 'versions', :action => 'create',
46 :project_id => 'foo', :format => 'xml' }
47 )
48 assert_routing(
49 { :method => 'post', :path => "/projects/foo/versions.json" },
50 { :controller => 'versions', :action => 'create',
51 :project_id => 'foo', :format => 'json' }
52 )
53 assert_routing(
54 { :method => 'get', :path => "/versions/1" },
55 { :controller => 'versions', :action => 'show', :id => '1' }
56 )
57 assert_routing(
58 { :method => 'get', :path => "/versions/1.xml" },
59 { :controller => 'versions', :action => 'show', :id => '1',
60 :format => 'xml' }
61 )
62 assert_routing(
63 { :method => 'get', :path => "/versions/1.json" },
64 { :controller => 'versions', :action => 'show', :id => '1',
65 :format => 'json' }
66 )
67 assert_routing(
68 { :method => 'get', :path => "/versions/1/edit" },
69 { :controller => 'versions', :action => 'edit', :id => '1' }
70 )
71 assert_routing(
72 { :method => 'put', :path => "/versions/1" },
73 { :controller => 'versions', :action => 'update', :id => '1' }
74 )
75 assert_routing(
76 { :method => 'put', :path => "/versions/1.xml" },
77 { :controller => 'versions', :action => 'update', :id => '1',
78 :format => 'xml' }
79 )
80 assert_routing(
81 { :method => 'put', :path => "/versions/1.json" },
82 { :controller => 'versions', :action => 'update', :id => '1',
83 :format => 'json' }
84 )
85 assert_routing(
86 { :method => 'delete', :path => "/versions/1" },
87 { :controller => 'versions', :action => 'destroy', :id => '1' }
88 )
89 assert_routing(
90 { :method => 'delete', :path => "/versions/1.xml" },
91 { :controller => 'versions', :action => 'destroy', :id => '1',
92 :format => 'xml' }
93 )
94 assert_routing(
95 { :method => 'delete', :path => "/versions/1.json" },
96 { :controller => 'versions', :action => 'destroy', :id => '1',
97 :format => 'json' }
98 )
99 assert_routing(
100 { :method => 'put', :path => "/projects/foo/versions/close_completed" },
101 { :controller => 'versions', :action => 'close_completed',
102 :project_id => 'foo' }
103 )
104 assert_routing(
105 { :method => 'post', :path => "/versions/1/status_by" },
106 { :controller => 'versions', :action => 'status_by', :id => '1' }
107 )
108 end
109 end
@@ -1,1069 +1,980
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_members
249 def test_members
250 assert_routing(
250 assert_routing(
251 { :method => 'post', :path => "/projects/5234/members/new" },
251 { :method => 'post', :path => "/projects/5234/members/new" },
252 { :controller => 'members', :action => 'new', :id => '5234' }
252 { :controller => 'members', :action => 'new', :id => '5234' }
253 )
253 )
254 end
254 end
255
255
256 def test_news
256 def test_news
257 assert_routing(
257 assert_routing(
258 { :method => 'get', :path => "/news" },
258 { :method => 'get', :path => "/news" },
259 { :controller => 'news', :action => 'index' }
259 { :controller => 'news', :action => 'index' }
260 )
260 )
261 assert_routing(
261 assert_routing(
262 { :method => 'get', :path => "/news.atom" },
262 { :method => 'get', :path => "/news.atom" },
263 { :controller => 'news', :action => 'index', :format => 'atom' }
263 { :controller => 'news', :action => 'index', :format => 'atom' }
264 )
264 )
265 assert_routing(
265 assert_routing(
266 { :method => 'get', :path => "/news.xml" },
266 { :method => 'get', :path => "/news.xml" },
267 { :controller => 'news', :action => 'index', :format => 'xml' }
267 { :controller => 'news', :action => 'index', :format => 'xml' }
268 )
268 )
269 assert_routing(
269 assert_routing(
270 { :method => 'get', :path => "/news.json" },
270 { :method => 'get', :path => "/news.json" },
271 { :controller => 'news', :action => 'index', :format => 'json' }
271 { :controller => 'news', :action => 'index', :format => 'json' }
272 )
272 )
273 assert_routing(
273 assert_routing(
274 { :method => 'get', :path => "/projects/567/news" },
274 { :method => 'get', :path => "/projects/567/news" },
275 { :controller => 'news', :action => 'index', :project_id => '567' }
275 { :controller => 'news', :action => 'index', :project_id => '567' }
276 )
276 )
277 assert_routing(
277 assert_routing(
278 { :method => 'get', :path => "/projects/567/news.atom" },
278 { :method => 'get', :path => "/projects/567/news.atom" },
279 { :controller => 'news', :action => 'index', :format => 'atom',
279 { :controller => 'news', :action => 'index', :format => 'atom',
280 :project_id => '567' }
280 :project_id => '567' }
281 )
281 )
282 assert_routing(
282 assert_routing(
283 { :method => 'get', :path => "/projects/567/news.xml" },
283 { :method => 'get', :path => "/projects/567/news.xml" },
284 { :controller => 'news', :action => 'index', :format => 'xml',
284 { :controller => 'news', :action => 'index', :format => 'xml',
285 :project_id => '567' }
285 :project_id => '567' }
286 )
286 )
287 assert_routing(
287 assert_routing(
288 { :method => 'get', :path => "/projects/567/news.json" },
288 { :method => 'get', :path => "/projects/567/news.json" },
289 { :controller => 'news', :action => 'index', :format => 'json',
289 { :controller => 'news', :action => 'index', :format => 'json',
290 :project_id => '567' }
290 :project_id => '567' }
291 )
291 )
292 assert_routing(
292 assert_routing(
293 { :method => 'get', :path => "/news/2" },
293 { :method => 'get', :path => "/news/2" },
294 { :controller => 'news', :action => 'show', :id => '2' }
294 { :controller => 'news', :action => 'show', :id => '2' }
295 )
295 )
296 assert_routing(
296 assert_routing(
297 { :method => 'get', :path => "/projects/567/news/new" },
297 { :method => 'get', :path => "/projects/567/news/new" },
298 { :controller => 'news', :action => 'new', :project_id => '567' }
298 { :controller => 'news', :action => 'new', :project_id => '567' }
299 )
299 )
300 assert_routing(
300 assert_routing(
301 { :method => 'get', :path => "/news/234" },
301 { :method => 'get', :path => "/news/234" },
302 { :controller => 'news', :action => 'show', :id => '234' }
302 { :controller => 'news', :action => 'show', :id => '234' }
303 )
303 )
304 assert_routing(
304 assert_routing(
305 { :method => 'get', :path => "/news/567/edit" },
305 { :method => 'get', :path => "/news/567/edit" },
306 { :controller => 'news', :action => 'edit', :id => '567' }
306 { :controller => 'news', :action => 'edit', :id => '567' }
307 )
307 )
308 assert_routing(
308 assert_routing(
309 { :method => 'get', :path => "/news/preview" },
309 { :method => 'get', :path => "/news/preview" },
310 { :controller => 'previews', :action => 'news' }
310 { :controller => 'previews', :action => 'news' }
311 )
311 )
312 assert_routing(
312 assert_routing(
313 { :method => 'post', :path => "/projects/567/news" },
313 { :method => 'post', :path => "/projects/567/news" },
314 { :controller => 'news', :action => 'create', :project_id => '567' }
314 { :controller => 'news', :action => 'create', :project_id => '567' }
315 )
315 )
316 assert_routing(
316 assert_routing(
317 { :method => 'post', :path => "/news/567/comments" },
317 { :method => 'post', :path => "/news/567/comments" },
318 { :controller => 'comments', :action => 'create', :id => '567' }
318 { :controller => 'comments', :action => 'create', :id => '567' }
319 )
319 )
320 assert_routing(
320 assert_routing(
321 { :method => 'put', :path => "/news/567" },
321 { :method => 'put', :path => "/news/567" },
322 { :controller => 'news', :action => 'update', :id => '567' }
322 { :controller => 'news', :action => 'update', :id => '567' }
323 )
323 )
324 assert_routing(
324 assert_routing(
325 { :method => 'delete', :path => "/news/567" },
325 { :method => 'delete', :path => "/news/567" },
326 { :controller => 'news', :action => 'destroy', :id => '567' }
326 { :controller => 'news', :action => 'destroy', :id => '567' }
327 )
327 )
328 assert_routing(
328 assert_routing(
329 { :method => 'delete', :path => "/news/567/comments/15" },
329 { :method => 'delete', :path => "/news/567/comments/15" },
330 { :controller => 'comments', :action => 'destroy', :id => '567',
330 { :controller => 'comments', :action => 'destroy', :id => '567',
331 :comment_id => '15' }
331 :comment_id => '15' }
332 )
332 )
333 end
333 end
334
334
335 def test_projects
335 def test_projects
336 assert_routing(
336 assert_routing(
337 { :method => 'get', :path => "/projects" },
337 { :method => 'get', :path => "/projects" },
338 { :controller => 'projects', :action => 'index' }
338 { :controller => 'projects', :action => 'index' }
339 )
339 )
340 assert_routing(
340 assert_routing(
341 { :method => 'get', :path => "/projects.atom" },
341 { :method => 'get', :path => "/projects.atom" },
342 { :controller => 'projects', :action => 'index', :format => 'atom' }
342 { :controller => 'projects', :action => 'index', :format => 'atom' }
343 )
343 )
344 assert_routing(
344 assert_routing(
345 { :method => 'get', :path => "/projects.xml" },
345 { :method => 'get', :path => "/projects.xml" },
346 { :controller => 'projects', :action => 'index', :format => 'xml' }
346 { :controller => 'projects', :action => 'index', :format => 'xml' }
347 )
347 )
348 assert_routing(
348 assert_routing(
349 { :method => 'get', :path => "/projects/new" },
349 { :method => 'get', :path => "/projects/new" },
350 { :controller => 'projects', :action => 'new' }
350 { :controller => 'projects', :action => 'new' }
351 )
351 )
352 assert_routing(
352 assert_routing(
353 { :method => 'get', :path => "/projects/test" },
353 { :method => 'get', :path => "/projects/test" },
354 { :controller => 'projects', :action => 'show', :id => 'test' }
354 { :controller => 'projects', :action => 'show', :id => 'test' }
355 )
355 )
356 assert_routing(
356 assert_routing(
357 { :method => 'get', :path => "/projects/1.xml" },
357 { :method => 'get', :path => "/projects/1.xml" },
358 { :controller => 'projects', :action => 'show', :id => '1',
358 { :controller => 'projects', :action => 'show', :id => '1',
359 :format => 'xml' }
359 :format => 'xml' }
360 )
360 )
361 assert_routing(
361 assert_routing(
362 { :method => 'get', :path => "/projects/4223/settings" },
362 { :method => 'get', :path => "/projects/4223/settings" },
363 { :controller => 'projects', :action => 'settings', :id => '4223' }
363 { :controller => 'projects', :action => 'settings', :id => '4223' }
364 )
364 )
365 assert_routing(
365 assert_routing(
366 { :method => 'get', :path => "/projects/4223/settings/members" },
366 { :method => 'get', :path => "/projects/4223/settings/members" },
367 { :controller => 'projects', :action => 'settings', :id => '4223',
367 { :controller => 'projects', :action => 'settings', :id => '4223',
368 :tab => 'members' }
368 :tab => 'members' }
369 )
369 )
370 assert_routing(
370 assert_routing(
371 { :method => 'get', :path => "/projects/33/roadmap" },
371 { :method => 'get', :path => "/projects/33/roadmap" },
372 { :controller => 'versions', :action => 'index', :project_id => '33' }
372 { :controller => 'versions', :action => 'index', :project_id => '33' }
373 )
373 )
374 assert_routing(
374 assert_routing(
375 { :method => 'get', :path => "/projects/33/activity" },
375 { :method => 'get', :path => "/projects/33/activity" },
376 { :controller => 'activities', :action => 'index', :id => '33' }
376 { :controller => 'activities', :action => 'index', :id => '33' }
377 )
377 )
378 assert_routing(
378 assert_routing(
379 { :method => 'get', :path => "/projects/33/activity.atom" },
379 { :method => 'get', :path => "/projects/33/activity.atom" },
380 { :controller => 'activities', :action => 'index', :id => '33',
380 { :controller => 'activities', :action => 'index', :id => '33',
381 :format => 'atom' }
381 :format => 'atom' }
382 )
382 )
383 assert_routing(
383 assert_routing(
384 { :method => 'post', :path => "/projects" },
384 { :method => 'post', :path => "/projects" },
385 { :controller => 'projects', :action => 'create' }
385 { :controller => 'projects', :action => 'create' }
386 )
386 )
387 assert_routing(
387 assert_routing(
388 { :method => 'post', :path => "/projects.xml" },
388 { :method => 'post', :path => "/projects.xml" },
389 { :controller => 'projects', :action => 'create', :format => 'xml' }
389 { :controller => 'projects', :action => 'create', :format => 'xml' }
390 )
390 )
391 assert_routing(
391 assert_routing(
392 { :method => 'post', :path => "/projects/64/archive" },
392 { :method => 'post', :path => "/projects/64/archive" },
393 { :controller => 'projects', :action => 'archive', :id => '64' }
393 { :controller => 'projects', :action => 'archive', :id => '64' }
394 )
394 )
395 assert_routing(
395 assert_routing(
396 { :method => 'post', :path => "/projects/64/unarchive" },
396 { :method => 'post', :path => "/projects/64/unarchive" },
397 { :controller => 'projects', :action => 'unarchive', :id => '64' }
397 { :controller => 'projects', :action => 'unarchive', :id => '64' }
398 )
398 )
399 assert_routing(
399 assert_routing(
400 { :method => 'put', :path => "/projects/64/enumerations" },
400 { :method => 'put', :path => "/projects/64/enumerations" },
401 { :controller => 'project_enumerations', :action => 'update',
401 { :controller => 'project_enumerations', :action => 'update',
402 :project_id => '64' }
402 :project_id => '64' }
403 )
403 )
404 assert_routing(
404 assert_routing(
405 { :method => 'put', :path => "/projects/4223" },
405 { :method => 'put', :path => "/projects/4223" },
406 { :controller => 'projects', :action => 'update', :id => '4223' }
406 { :controller => 'projects', :action => 'update', :id => '4223' }
407 )
407 )
408 assert_routing(
408 assert_routing(
409 { :method => 'put', :path => "/projects/1.xml" },
409 { :method => 'put', :path => "/projects/1.xml" },
410 { :controller => 'projects', :action => 'update', :id => '1',
410 { :controller => 'projects', :action => 'update', :id => '1',
411 :format => 'xml' }
411 :format => 'xml' }
412 )
412 )
413 assert_routing(
413 assert_routing(
414 { :method => 'delete', :path => "/projects/64" },
414 { :method => 'delete', :path => "/projects/64" },
415 { :controller => 'projects', :action => 'destroy', :id => '64' }
415 { :controller => 'projects', :action => 'destroy', :id => '64' }
416 )
416 )
417 assert_routing(
417 assert_routing(
418 { :method => 'delete', :path => "/projects/1.xml" },
418 { :method => 'delete', :path => "/projects/1.xml" },
419 { :controller => 'projects', :action => 'destroy', :id => '1',
419 { :controller => 'projects', :action => 'destroy', :id => '1',
420 :format => 'xml' }
420 :format => 'xml' }
421 )
421 )
422 assert_routing(
422 assert_routing(
423 { :method => 'delete', :path => "/projects/64/enumerations" },
423 { :method => 'delete', :path => "/projects/64/enumerations" },
424 { :controller => 'project_enumerations', :action => 'destroy',
424 { :controller => 'project_enumerations', :action => 'destroy',
425 :project_id => '64' }
425 :project_id => '64' }
426 )
426 )
427 end
427 end
428
428
429 def test_queries
429 def test_queries
430 assert_routing(
430 assert_routing(
431 { :method => 'get', :path => "/queries.xml" },
431 { :method => 'get', :path => "/queries.xml" },
432 { :controller => 'queries', :action => 'index', :format => 'xml' }
432 { :controller => 'queries', :action => 'index', :format => 'xml' }
433 )
433 )
434 assert_routing(
434 assert_routing(
435 { :method => 'get', :path => "/queries.json" },
435 { :method => 'get', :path => "/queries.json" },
436 { :controller => 'queries', :action => 'index', :format => 'json' }
436 { :controller => 'queries', :action => 'index', :format => 'json' }
437 )
437 )
438 assert_routing(
438 assert_routing(
439 { :method => 'get', :path => "/queries/new" },
439 { :method => 'get', :path => "/queries/new" },
440 { :controller => 'queries', :action => 'new' }
440 { :controller => 'queries', :action => 'new' }
441 )
441 )
442 assert_routing(
442 assert_routing(
443 { :method => 'get', :path => "/projects/redmine/queries/new" },
443 { :method => 'get', :path => "/projects/redmine/queries/new" },
444 { :controller => 'queries', :action => 'new', :project_id => 'redmine' }
444 { :controller => 'queries', :action => 'new', :project_id => 'redmine' }
445 )
445 )
446 assert_routing(
446 assert_routing(
447 { :method => 'post', :path => "/queries" },
447 { :method => 'post', :path => "/queries" },
448 { :controller => 'queries', :action => 'create' }
448 { :controller => 'queries', :action => 'create' }
449 )
449 )
450 assert_routing(
450 assert_routing(
451 { :method => 'post', :path => "/projects/redmine/queries" },
451 { :method => 'post', :path => "/projects/redmine/queries" },
452 { :controller => 'queries', :action => 'create', :project_id => 'redmine' }
452 { :controller => 'queries', :action => 'create', :project_id => 'redmine' }
453 )
453 )
454 assert_routing(
454 assert_routing(
455 { :method => 'get', :path => "/queries/1/edit" },
455 { :method => 'get', :path => "/queries/1/edit" },
456 { :controller => 'queries', :action => 'edit', :id => '1' }
456 { :controller => 'queries', :action => 'edit', :id => '1' }
457 )
457 )
458 assert_routing(
458 assert_routing(
459 { :method => 'put', :path => "/queries/1" },
459 { :method => 'put', :path => "/queries/1" },
460 { :controller => 'queries', :action => 'update', :id => '1' }
460 { :controller => 'queries', :action => 'update', :id => '1' }
461 )
461 )
462 assert_routing(
462 assert_routing(
463 { :method => 'delete', :path => "/queries/1" },
463 { :method => 'delete', :path => "/queries/1" },
464 { :controller => 'queries', :action => 'destroy', :id => '1' }
464 { :controller => 'queries', :action => 'destroy', :id => '1' }
465 )
465 )
466 end
466 end
467
467
468 def test_repositories
468 def test_repositories
469 assert_routing(
469 assert_routing(
470 { :method => 'get',
470 { :method => 'get',
471 :path => "/projects/redmine/repository" },
471 :path => "/projects/redmine/repository" },
472 { :controller => 'repositories', :action => 'show', :id => 'redmine' }
472 { :controller => 'repositories', :action => 'show', :id => 'redmine' }
473 )
473 )
474 assert_routing(
474 assert_routing(
475 { :method => 'get',
475 { :method => 'get',
476 :path => "/projects/redmine/repository/edit" },
476 :path => "/projects/redmine/repository/edit" },
477 { :controller => 'repositories', :action => 'edit', :id => 'redmine' }
477 { :controller => 'repositories', :action => 'edit', :id => 'redmine' }
478 )
478 )
479 assert_routing(
479 assert_routing(
480 { :method => 'get',
480 { :method => 'get',
481 :path => "/projects/redmine/repository/revisions" },
481 :path => "/projects/redmine/repository/revisions" },
482 { :controller => 'repositories', :action => 'revisions', :id => 'redmine' }
482 { :controller => 'repositories', :action => 'revisions', :id => 'redmine' }
483 )
483 )
484 assert_routing(
484 assert_routing(
485 { :method => 'get',
485 { :method => 'get',
486 :path => "/projects/redmine/repository/revisions.atom" },
486 :path => "/projects/redmine/repository/revisions.atom" },
487 { :controller => 'repositories', :action => 'revisions', :id => 'redmine',
487 { :controller => 'repositories', :action => 'revisions', :id => 'redmine',
488 :format => 'atom' }
488 :format => 'atom' }
489 )
489 )
490 assert_routing(
490 assert_routing(
491 { :method => 'get',
491 { :method => 'get',
492 :path => "/projects/redmine/repository/revisions/2457" },
492 :path => "/projects/redmine/repository/revisions/2457" },
493 { :controller => 'repositories', :action => 'revision', :id => 'redmine',
493 { :controller => 'repositories', :action => 'revision', :id => 'redmine',
494 :rev => '2457' }
494 :rev => '2457' }
495 )
495 )
496 assert_routing(
496 assert_routing(
497 { :method => 'get',
497 { :method => 'get',
498 :path => "/projects/redmine/repository/revisions/2457/diff" },
498 :path => "/projects/redmine/repository/revisions/2457/diff" },
499 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
499 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
500 :rev => '2457' }
500 :rev => '2457' }
501 )
501 )
502 assert_routing(
502 assert_routing(
503 { :method => 'get',
503 { :method => 'get',
504 :path => "/projects/redmine/repository/revisions/2457/diff.diff" },
504 :path => "/projects/redmine/repository/revisions/2457/diff.diff" },
505 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
505 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
506 :rev => '2457', :format => 'diff' }
506 :rev => '2457', :format => 'diff' }
507 )
507 )
508 assert_routing(
508 assert_routing(
509 { :method => 'get',
509 { :method => 'get',
510 :path => "/projects/redmine/repository/diff/path/to/file.c" },
510 :path => "/projects/redmine/repository/diff/path/to/file.c" },
511 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
511 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
512 :path => %w[path to file.c] }
512 :path => %w[path to file.c] }
513 )
513 )
514 assert_routing(
514 assert_routing(
515 { :method => 'get',
515 { :method => 'get',
516 :path => "/projects/redmine/repository/revisions/2/diff/path/to/file.c" },
516 :path => "/projects/redmine/repository/revisions/2/diff/path/to/file.c" },
517 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
517 { :controller => 'repositories', :action => 'diff', :id => 'redmine',
518 :path => %w[path to file.c], :rev => '2' }
518 :path => %w[path to file.c], :rev => '2' }
519 )
519 )
520 assert_routing(
520 assert_routing(
521 { :method => 'get',
521 { :method => 'get',
522 :path => "/projects/redmine/repository/browse/path/to/file.c" },
522 :path => "/projects/redmine/repository/browse/path/to/file.c" },
523 { :controller => 'repositories', :action => 'browse', :id => 'redmine',
523 { :controller => 'repositories', :action => 'browse', :id => 'redmine',
524 :path => %w[path to file.c] }
524 :path => %w[path to file.c] }
525 )
525 )
526 assert_routing(
526 assert_routing(
527 { :method => 'get',
527 { :method => 'get',
528 :path => "/projects/redmine/repository/entry/path/to/file.c" },
528 :path => "/projects/redmine/repository/entry/path/to/file.c" },
529 { :controller => 'repositories', :action => 'entry', :id => 'redmine',
529 { :controller => 'repositories', :action => 'entry', :id => 'redmine',
530 :path => %w[path to file.c] }
530 :path => %w[path to file.c] }
531 )
531 )
532 assert_routing(
532 assert_routing(
533 { :method => 'get',
533 { :method => 'get',
534 :path => "/projects/redmine/repository/revisions/2/entry/path/to/file.c" },
534 :path => "/projects/redmine/repository/revisions/2/entry/path/to/file.c" },
535 { :controller => 'repositories', :action => 'entry', :id => 'redmine',
535 { :controller => 'repositories', :action => 'entry', :id => 'redmine',
536 :path => %w[path to file.c], :rev => '2' }
536 :path => %w[path to file.c], :rev => '2' }
537 )
537 )
538 assert_routing(
538 assert_routing(
539 { :method => 'get',
539 { :method => 'get',
540 :path => "/projects/redmine/repository/raw/path/to/file.c" },
540 :path => "/projects/redmine/repository/raw/path/to/file.c" },
541 { :controller => 'repositories', :action => 'entry', :id => 'redmine',
541 { :controller => 'repositories', :action => 'entry', :id => 'redmine',
542 :path => %w[path to file.c], :format => 'raw' }
542 :path => %w[path to file.c], :format => 'raw' }
543 )
543 )
544 assert_routing(
544 assert_routing(
545 { :method => 'get',
545 { :method => 'get',
546 :path => "/projects/redmine/repository/revisions/2/raw/path/to/file.c" },
546 :path => "/projects/redmine/repository/revisions/2/raw/path/to/file.c" },
547 { :controller => 'repositories', :action => 'entry', :id => 'redmine',
547 { :controller => 'repositories', :action => 'entry', :id => 'redmine',
548 :path => %w[path to file.c], :rev => '2', :format => 'raw' }
548 :path => %w[path to file.c], :rev => '2', :format => 'raw' }
549 )
549 )
550 assert_routing(
550 assert_routing(
551 { :method => 'get',
551 { :method => 'get',
552 :path => "/projects/redmine/repository/annotate/path/to/file.c" },
552 :path => "/projects/redmine/repository/annotate/path/to/file.c" },
553 { :controller => 'repositories', :action => 'annotate', :id => 'redmine',
553 { :controller => 'repositories', :action => 'annotate', :id => 'redmine',
554 :path => %w[path to file.c] }
554 :path => %w[path to file.c] }
555 )
555 )
556 assert_routing(
556 assert_routing(
557 { :method => 'get',
557 { :method => 'get',
558 :path => "/projects/redmine/repository/changes/path/to/file.c" },
558 :path => "/projects/redmine/repository/changes/path/to/file.c" },
559 { :controller => 'repositories', :action => 'changes', :id => 'redmine',
559 { :controller => 'repositories', :action => 'changes', :id => 'redmine',
560 :path => %w[path to file.c] }
560 :path => %w[path to file.c] }
561 )
561 )
562 assert_routing(
562 assert_routing(
563 { :method => 'get',
563 { :method => 'get',
564 :path => "/projects/redmine/repository/statistics" },
564 :path => "/projects/redmine/repository/statistics" },
565 { :controller => 'repositories', :action => 'stats', :id => 'redmine' }
565 { :controller => 'repositories', :action => 'stats', :id => 'redmine' }
566 )
566 )
567 assert_routing(
567 assert_routing(
568 { :method => 'post',
568 { :method => 'post',
569 :path => "/projects/redmine/repository/edit" },
569 :path => "/projects/redmine/repository/edit" },
570 { :controller => 'repositories', :action => 'edit', :id => 'redmine' }
570 { :controller => 'repositories', :action => 'edit', :id => 'redmine' }
571 )
571 )
572 end
572 end
573
573
574 def test_roles
574 def test_roles
575 assert_routing(
575 assert_routing(
576 { :method => 'get', :path => "/roles" },
576 { :method => 'get', :path => "/roles" },
577 { :controller => 'roles', :action => 'index' }
577 { :controller => 'roles', :action => 'index' }
578 )
578 )
579 assert_routing(
579 assert_routing(
580 { :method => 'get', :path => "/roles/new" },
580 { :method => 'get', :path => "/roles/new" },
581 { :controller => 'roles', :action => 'new' }
581 { :controller => 'roles', :action => 'new' }
582 )
582 )
583 assert_routing(
583 assert_routing(
584 { :method => 'post', :path => "/roles" },
584 { :method => 'post', :path => "/roles" },
585 { :controller => 'roles', :action => 'create' }
585 { :controller => 'roles', :action => 'create' }
586 )
586 )
587 assert_routing(
587 assert_routing(
588 { :method => 'get', :path => "/roles/2/edit" },
588 { :method => 'get', :path => "/roles/2/edit" },
589 { :controller => 'roles', :action => 'edit', :id => '2' }
589 { :controller => 'roles', :action => 'edit', :id => '2' }
590 )
590 )
591 assert_routing(
591 assert_routing(
592 { :method => 'put', :path => "/roles/2" },
592 { :method => 'put', :path => "/roles/2" },
593 { :controller => 'roles', :action => 'update', :id => '2' }
593 { :controller => 'roles', :action => 'update', :id => '2' }
594 )
594 )
595 assert_routing(
595 assert_routing(
596 { :method => 'delete', :path => "/roles/2" },
596 { :method => 'delete', :path => "/roles/2" },
597 { :controller => 'roles', :action => 'destroy', :id => '2' }
597 { :controller => 'roles', :action => 'destroy', :id => '2' }
598 )
598 )
599 assert_routing(
599 assert_routing(
600 { :method => 'get', :path => "/roles/permissions" },
600 { :method => 'get', :path => "/roles/permissions" },
601 { :controller => 'roles', :action => 'permissions' }
601 { :controller => 'roles', :action => 'permissions' }
602 )
602 )
603 assert_routing(
603 assert_routing(
604 { :method => 'post', :path => "/roles/permissions" },
604 { :method => 'post', :path => "/roles/permissions" },
605 { :controller => 'roles', :action => 'permissions' }
605 { :controller => 'roles', :action => 'permissions' }
606 )
606 )
607 end
607 end
608
608
609 def test_timelogs_global
609 def test_timelogs_global
610 assert_routing(
610 assert_routing(
611 { :method => 'get', :path => "/time_entries" },
611 { :method => 'get', :path => "/time_entries" },
612 { :controller => 'timelog', :action => 'index' }
612 { :controller => 'timelog', :action => 'index' }
613 )
613 )
614 assert_routing(
614 assert_routing(
615 { :method => 'get', :path => "/time_entries.csv" },
615 { :method => 'get', :path => "/time_entries.csv" },
616 { :controller => 'timelog', :action => 'index', :format => 'csv' }
616 { :controller => 'timelog', :action => 'index', :format => 'csv' }
617 )
617 )
618 assert_routing(
618 assert_routing(
619 { :method => 'get', :path => "/time_entries.atom" },
619 { :method => 'get', :path => "/time_entries.atom" },
620 { :controller => 'timelog', :action => 'index', :format => 'atom' }
620 { :controller => 'timelog', :action => 'index', :format => 'atom' }
621 )
621 )
622 assert_routing(
622 assert_routing(
623 { :method => 'get', :path => "/time_entries/new" },
623 { :method => 'get', :path => "/time_entries/new" },
624 { :controller => 'timelog', :action => 'new' }
624 { :controller => 'timelog', :action => 'new' }
625 )
625 )
626 assert_routing(
626 assert_routing(
627 { :method => 'get', :path => "/time_entries/22/edit" },
627 { :method => 'get', :path => "/time_entries/22/edit" },
628 { :controller => 'timelog', :action => 'edit', :id => '22' }
628 { :controller => 'timelog', :action => 'edit', :id => '22' }
629 )
629 )
630 assert_routing(
630 assert_routing(
631 { :method => 'post', :path => "/time_entries" },
631 { :method => 'post', :path => "/time_entries" },
632 { :controller => 'timelog', :action => 'create' }
632 { :controller => 'timelog', :action => 'create' }
633 )
633 )
634 assert_routing(
634 assert_routing(
635 { :method => 'put', :path => "/time_entries/22" },
635 { :method => 'put', :path => "/time_entries/22" },
636 { :controller => 'timelog', :action => 'update', :id => '22' }
636 { :controller => 'timelog', :action => 'update', :id => '22' }
637 )
637 )
638 assert_routing(
638 assert_routing(
639 { :method => 'delete', :path => "/time_entries/55" },
639 { :method => 'delete', :path => "/time_entries/55" },
640 { :controller => 'timelog', :action => 'destroy', :id => '55' }
640 { :controller => 'timelog', :action => 'destroy', :id => '55' }
641 )
641 )
642 end
642 end
643
643
644 def test_timelogs_scoped_under_project
644 def test_timelogs_scoped_under_project
645 assert_routing(
645 assert_routing(
646 { :method => 'get', :path => "/projects/567/time_entries" },
646 { :method => 'get', :path => "/projects/567/time_entries" },
647 { :controller => 'timelog', :action => 'index', :project_id => '567' }
647 { :controller => 'timelog', :action => 'index', :project_id => '567' }
648 )
648 )
649 assert_routing(
649 assert_routing(
650 { :method => 'get', :path => "/projects/567/time_entries.csv" },
650 { :method => 'get', :path => "/projects/567/time_entries.csv" },
651 { :controller => 'timelog', :action => 'index', :project_id => '567',
651 { :controller => 'timelog', :action => 'index', :project_id => '567',
652 :format => 'csv' }
652 :format => 'csv' }
653 )
653 )
654 assert_routing(
654 assert_routing(
655 { :method => 'get', :path => "/projects/567/time_entries.atom" },
655 { :method => 'get', :path => "/projects/567/time_entries.atom" },
656 { :controller => 'timelog', :action => 'index', :project_id => '567',
656 { :controller => 'timelog', :action => 'index', :project_id => '567',
657 :format => 'atom' }
657 :format => 'atom' }
658 )
658 )
659 assert_routing(
659 assert_routing(
660 { :method => 'get', :path => "/projects/567/time_entries/new" },
660 { :method => 'get', :path => "/projects/567/time_entries/new" },
661 { :controller => 'timelog', :action => 'new', :project_id => '567' }
661 { :controller => 'timelog', :action => 'new', :project_id => '567' }
662 )
662 )
663 assert_routing(
663 assert_routing(
664 { :method => 'get', :path => "/projects/567/time_entries/22/edit" },
664 { :method => 'get', :path => "/projects/567/time_entries/22/edit" },
665 { :controller => 'timelog', :action => 'edit',
665 { :controller => 'timelog', :action => 'edit',
666 :id => '22', :project_id => '567' }
666 :id => '22', :project_id => '567' }
667 )
667 )
668 assert_routing(
668 assert_routing(
669 { :method => 'post', :path => "/projects/567/time_entries" },
669 { :method => 'post', :path => "/projects/567/time_entries" },
670 { :controller => 'timelog', :action => 'create',
670 { :controller => 'timelog', :action => 'create',
671 :project_id => '567' }
671 :project_id => '567' }
672 )
672 )
673 assert_routing(
673 assert_routing(
674 { :method => 'put', :path => "/projects/567/time_entries/22" },
674 { :method => 'put', :path => "/projects/567/time_entries/22" },
675 { :controller => 'timelog', :action => 'update',
675 { :controller => 'timelog', :action => 'update',
676 :id => '22', :project_id => '567' }
676 :id => '22', :project_id => '567' }
677 )
677 )
678 assert_routing(
678 assert_routing(
679 { :method => 'delete', :path => "/projects/567/time_entries/55" },
679 { :method => 'delete', :path => "/projects/567/time_entries/55" },
680 { :controller => 'timelog', :action => 'destroy',
680 { :controller => 'timelog', :action => 'destroy',
681 :id => '55', :project_id => '567' }
681 :id => '55', :project_id => '567' }
682 )
682 )
683 end
683 end
684
684
685 def test_timelogs_scoped_under_issues
685 def test_timelogs_scoped_under_issues
686 assert_routing(
686 assert_routing(
687 { :method => 'get', :path => "/issues/234/time_entries" },
687 { :method => 'get', :path => "/issues/234/time_entries" },
688 { :controller => 'timelog', :action => 'index', :issue_id => '234' }
688 { :controller => 'timelog', :action => 'index', :issue_id => '234' }
689 )
689 )
690 assert_routing(
690 assert_routing(
691 { :method => 'get', :path => "/issues/234/time_entries.csv" },
691 { :method => 'get', :path => "/issues/234/time_entries.csv" },
692 { :controller => 'timelog', :action => 'index', :issue_id => '234',
692 { :controller => 'timelog', :action => 'index', :issue_id => '234',
693 :format => 'csv' }
693 :format => 'csv' }
694 )
694 )
695 assert_routing(
695 assert_routing(
696 { :method => 'get', :path => "/issues/234/time_entries.atom" },
696 { :method => 'get', :path => "/issues/234/time_entries.atom" },
697 { :controller => 'timelog', :action => 'index', :issue_id => '234',
697 { :controller => 'timelog', :action => 'index', :issue_id => '234',
698 :format => 'atom' }
698 :format => 'atom' }
699 )
699 )
700 assert_routing(
700 assert_routing(
701 { :method => 'get', :path => "/issues/234/time_entries/new" },
701 { :method => 'get', :path => "/issues/234/time_entries/new" },
702 { :controller => 'timelog', :action => 'new', :issue_id => '234' }
702 { :controller => 'timelog', :action => 'new', :issue_id => '234' }
703 )
703 )
704 assert_routing(
704 assert_routing(
705 { :method => 'get', :path => "/issues/234/time_entries/22/edit" },
705 { :method => 'get', :path => "/issues/234/time_entries/22/edit" },
706 { :controller => 'timelog', :action => 'edit', :id => '22',
706 { :controller => 'timelog', :action => 'edit', :id => '22',
707 :issue_id => '234' }
707 :issue_id => '234' }
708 )
708 )
709 assert_routing(
709 assert_routing(
710 { :method => 'post', :path => "/issues/234/time_entries" },
710 { :method => 'post', :path => "/issues/234/time_entries" },
711 { :controller => 'timelog', :action => 'create', :issue_id => '234' }
711 { :controller => 'timelog', :action => 'create', :issue_id => '234' }
712 )
712 )
713 assert_routing(
713 assert_routing(
714 { :method => 'put', :path => "/issues/234/time_entries/22" },
714 { :method => 'put', :path => "/issues/234/time_entries/22" },
715 { :controller => 'timelog', :action => 'update', :id => '22',
715 { :controller => 'timelog', :action => 'update', :id => '22',
716 :issue_id => '234' }
716 :issue_id => '234' }
717 )
717 )
718 assert_routing(
718 assert_routing(
719 { :method => 'delete', :path => "/issues/234/time_entries/55" },
719 { :method => 'delete', :path => "/issues/234/time_entries/55" },
720 { :controller => 'timelog', :action => 'destroy', :id => '55',
720 { :controller => 'timelog', :action => 'destroy', :id => '55',
721 :issue_id => '234' }
721 :issue_id => '234' }
722 )
722 )
723 end
723 end
724
724
725 def test_timelogs_scoped_under_project_and_issues
725 def test_timelogs_scoped_under_project_and_issues
726 assert_routing(
726 assert_routing(
727 { :method => 'get',
727 { :method => 'get',
728 :path => "/projects/ecookbook/issues/234/time_entries" },
728 :path => "/projects/ecookbook/issues/234/time_entries" },
729 { :controller => 'timelog', :action => 'index',
729 { :controller => 'timelog', :action => 'index',
730 :issue_id => '234', :project_id => 'ecookbook' }
730 :issue_id => '234', :project_id => 'ecookbook' }
731 )
731 )
732 assert_routing(
732 assert_routing(
733 { :method => 'get',
733 { :method => 'get',
734 :path => "/projects/ecookbook/issues/234/time_entries.csv" },
734 :path => "/projects/ecookbook/issues/234/time_entries.csv" },
735 { :controller => 'timelog', :action => 'index',
735 { :controller => 'timelog', :action => 'index',
736 :issue_id => '234', :project_id => 'ecookbook', :format => 'csv' }
736 :issue_id => '234', :project_id => 'ecookbook', :format => 'csv' }
737 )
737 )
738 assert_routing(
738 assert_routing(
739 { :method => 'get',
739 { :method => 'get',
740 :path => "/projects/ecookbook/issues/234/time_entries.atom" },
740 :path => "/projects/ecookbook/issues/234/time_entries.atom" },
741 { :controller => 'timelog', :action => 'index',
741 { :controller => 'timelog', :action => 'index',
742 :issue_id => '234', :project_id => 'ecookbook', :format => 'atom' }
742 :issue_id => '234', :project_id => 'ecookbook', :format => 'atom' }
743 )
743 )
744 assert_routing(
744 assert_routing(
745 { :method => 'get',
745 { :method => 'get',
746 :path => "/projects/ecookbook/issues/234/time_entries/new" },
746 :path => "/projects/ecookbook/issues/234/time_entries/new" },
747 { :controller => 'timelog', :action => 'new',
747 { :controller => 'timelog', :action => 'new',
748 :issue_id => '234', :project_id => 'ecookbook' }
748 :issue_id => '234', :project_id => 'ecookbook' }
749 )
749 )
750 assert_routing(
750 assert_routing(
751 { :method => 'get',
751 { :method => 'get',
752 :path => "/projects/ecookbook/issues/234/time_entries/22/edit" },
752 :path => "/projects/ecookbook/issues/234/time_entries/22/edit" },
753 { :controller => 'timelog', :action => 'edit', :id => '22',
753 { :controller => 'timelog', :action => 'edit', :id => '22',
754 :issue_id => '234', :project_id => 'ecookbook' }
754 :issue_id => '234', :project_id => 'ecookbook' }
755 )
755 )
756 assert_routing(
756 assert_routing(
757 { :method => 'post',
757 { :method => 'post',
758 :path => "/projects/ecookbook/issues/234/time_entries" },
758 :path => "/projects/ecookbook/issues/234/time_entries" },
759 { :controller => 'timelog', :action => 'create',
759 { :controller => 'timelog', :action => 'create',
760 :issue_id => '234', :project_id => 'ecookbook' }
760 :issue_id => '234', :project_id => 'ecookbook' }
761 )
761 )
762 assert_routing(
762 assert_routing(
763 { :method => 'put',
763 { :method => 'put',
764 :path => "/projects/ecookbook/issues/234/time_entries/22" },
764 :path => "/projects/ecookbook/issues/234/time_entries/22" },
765 { :controller => 'timelog', :action => 'update', :id => '22',
765 { :controller => 'timelog', :action => 'update', :id => '22',
766 :issue_id => '234', :project_id => 'ecookbook' }
766 :issue_id => '234', :project_id => 'ecookbook' }
767 )
767 )
768 assert_routing(
768 assert_routing(
769 { :method => 'delete',
769 { :method => 'delete',
770 :path => "/projects/ecookbook/issues/234/time_entries/55" },
770 :path => "/projects/ecookbook/issues/234/time_entries/55" },
771 { :controller => 'timelog', :action => 'destroy', :id => '55',
771 { :controller => 'timelog', :action => 'destroy', :id => '55',
772 :issue_id => '234', :project_id => 'ecookbook' }
772 :issue_id => '234', :project_id => 'ecookbook' }
773 )
773 )
774 assert_routing(
774 assert_routing(
775 { :method => 'get',
775 { :method => 'get',
776 :path => "/time_entries/report" },
776 :path => "/time_entries/report" },
777 { :controller => 'timelog', :action => 'report' }
777 { :controller => 'timelog', :action => 'report' }
778 )
778 )
779 assert_routing(
779 assert_routing(
780 { :method => 'get',
780 { :method => 'get',
781 :path => "/projects/567/time_entries/report" },
781 :path => "/projects/567/time_entries/report" },
782 { :controller => 'timelog', :action => 'report', :project_id => '567' }
782 { :controller => 'timelog', :action => 'report', :project_id => '567' }
783 )
783 )
784 assert_routing(
784 assert_routing(
785 { :method => 'get',
785 { :method => 'get',
786 :path => "/projects/567/time_entries/report.csv" },
786 :path => "/projects/567/time_entries/report.csv" },
787 { :controller => 'timelog', :action => 'report', :project_id => '567',
787 { :controller => 'timelog', :action => 'report', :project_id => '567',
788 :format => 'csv' }
788 :format => 'csv' }
789 )
789 )
790 end
790 end
791
791
792 def test_users
792 def test_users
793 assert_routing(
793 assert_routing(
794 { :method => 'get', :path => "/users" },
794 { :method => 'get', :path => "/users" },
795 { :controller => 'users', :action => 'index' }
795 { :controller => 'users', :action => 'index' }
796 )
796 )
797 assert_routing(
797 assert_routing(
798 { :method => 'get', :path => "/users.xml" },
798 { :method => 'get', :path => "/users.xml" },
799 { :controller => 'users', :action => 'index', :format => 'xml' }
799 { :controller => 'users', :action => 'index', :format => 'xml' }
800 )
800 )
801 assert_routing(
801 assert_routing(
802 { :method => 'get', :path => "/users/44" },
802 { :method => 'get', :path => "/users/44" },
803 { :controller => 'users', :action => 'show', :id => '44' }
803 { :controller => 'users', :action => 'show', :id => '44' }
804 )
804 )
805 assert_routing(
805 assert_routing(
806 { :method => 'get', :path => "/users/44.xml" },
806 { :method => 'get', :path => "/users/44.xml" },
807 { :controller => 'users', :action => 'show', :id => '44',
807 { :controller => 'users', :action => 'show', :id => '44',
808 :format => 'xml' }
808 :format => 'xml' }
809 )
809 )
810 assert_routing(
810 assert_routing(
811 { :method => 'get', :path => "/users/current" },
811 { :method => 'get', :path => "/users/current" },
812 { :controller => 'users', :action => 'show', :id => 'current' }
812 { :controller => 'users', :action => 'show', :id => 'current' }
813 )
813 )
814 assert_routing(
814 assert_routing(
815 { :method => 'get', :path => "/users/current.xml" },
815 { :method => 'get', :path => "/users/current.xml" },
816 { :controller => 'users', :action => 'show', :id => 'current',
816 { :controller => 'users', :action => 'show', :id => 'current',
817 :format => 'xml' }
817 :format => 'xml' }
818 )
818 )
819 assert_routing(
819 assert_routing(
820 { :method => 'get', :path => "/users/new" },
820 { :method => 'get', :path => "/users/new" },
821 { :controller => 'users', :action => 'new' }
821 { :controller => 'users', :action => 'new' }
822 )
822 )
823 assert_routing(
823 assert_routing(
824 { :method => 'get', :path => "/users/444/edit" },
824 { :method => 'get', :path => "/users/444/edit" },
825 { :controller => 'users', :action => 'edit', :id => '444' }
825 { :controller => 'users', :action => 'edit', :id => '444' }
826 )
826 )
827 assert_routing(
827 assert_routing(
828 { :method => 'post', :path => "/users" },
828 { :method => 'post', :path => "/users" },
829 { :controller => 'users', :action => 'create' }
829 { :controller => 'users', :action => 'create' }
830 )
830 )
831 assert_routing(
831 assert_routing(
832 { :method => 'post', :path => "/users.xml" },
832 { :method => 'post', :path => "/users.xml" },
833 { :controller => 'users', :action => 'create', :format => 'xml' }
833 { :controller => 'users', :action => 'create', :format => 'xml' }
834 )
834 )
835 assert_routing(
835 assert_routing(
836 { :method => 'put', :path => "/users/444" },
836 { :method => 'put', :path => "/users/444" },
837 { :controller => 'users', :action => 'update', :id => '444' }
837 { :controller => 'users', :action => 'update', :id => '444' }
838 )
838 )
839 assert_routing(
839 assert_routing(
840 { :method => 'put', :path => "/users/444.xml" },
840 { :method => 'put', :path => "/users/444.xml" },
841 { :controller => 'users', :action => 'update', :id => '444',
841 { :controller => 'users', :action => 'update', :id => '444',
842 :format => 'xml' }
842 :format => 'xml' }
843 )
843 )
844 assert_routing(
844 assert_routing(
845 { :method => 'delete', :path => "/users/44" },
845 { :method => 'delete', :path => "/users/44" },
846 { :controller => 'users', :action => 'destroy', :id => '44' }
846 { :controller => 'users', :action => 'destroy', :id => '44' }
847 )
847 )
848 assert_routing(
848 assert_routing(
849 { :method => 'delete', :path => "/users/44.xml" },
849 { :method => 'delete', :path => "/users/44.xml" },
850 { :controller => 'users', :action => 'destroy', :id => '44',
850 { :controller => 'users', :action => 'destroy', :id => '44',
851 :format => 'xml' }
851 :format => 'xml' }
852 )
852 )
853 assert_routing(
853 assert_routing(
854 { :method => 'post', :path => "/users/123/memberships" },
854 { :method => 'post', :path => "/users/123/memberships" },
855 { :controller => 'users', :action => 'edit_membership',
855 { :controller => 'users', :action => 'edit_membership',
856 :id => '123' }
856 :id => '123' }
857 )
857 )
858 assert_routing(
858 assert_routing(
859 { :method => 'put', :path => "/users/123/memberships/55" },
859 { :method => 'put', :path => "/users/123/memberships/55" },
860 { :controller => 'users', :action => 'edit_membership',
860 { :controller => 'users', :action => 'edit_membership',
861 :id => '123', :membership_id => '55' }
861 :id => '123', :membership_id => '55' }
862 )
862 )
863 assert_routing(
863 assert_routing(
864 { :method => 'delete', :path => "/users/123/memberships/55" },
864 { :method => 'delete', :path => "/users/123/memberships/55" },
865 { :controller => 'users', :action => 'destroy_membership',
865 { :controller => 'users', :action => 'destroy_membership',
866 :id => '123', :membership_id => '55' }
866 :id => '123', :membership_id => '55' }
867 )
867 )
868 end
868 end
869
869
870 def test_versions
871 # /projects/foo/versions is /projects/foo/roadmap
872 assert_routing(
873 { :method => 'get', :path => "/projects/foo/versions.xml" },
874 { :controller => 'versions', :action => 'index',
875 :project_id => 'foo', :format => 'xml' }
876 )
877 assert_routing(
878 { :method => 'get', :path => "/projects/foo/versions.json" },
879 { :controller => 'versions', :action => 'index',
880 :project_id => 'foo', :format => 'json' }
881 )
882 assert_routing(
883 { :method => 'get', :path => "/projects/foo/versions/new" },
884 { :controller => 'versions', :action => 'new',
885 :project_id => 'foo' }
886 )
887 assert_routing(
888 { :method => 'post', :path => "/projects/foo/versions" },
889 { :controller => 'versions', :action => 'create',
890 :project_id => 'foo' }
891 )
892 assert_routing(
893 { :method => 'post', :path => "/projects/foo/versions.xml" },
894 { :controller => 'versions', :action => 'create',
895 :project_id => 'foo', :format => 'xml' }
896 )
897 assert_routing(
898 { :method => 'post', :path => "/projects/foo/versions.json" },
899 { :controller => 'versions', :action => 'create',
900 :project_id => 'foo', :format => 'json' }
901 )
902 assert_routing(
903 { :method => 'get', :path => "/versions/1" },
904 { :controller => 'versions', :action => 'show', :id => '1' }
905 )
906 assert_routing(
907 { :method => 'get', :path => "/versions/1.xml" },
908 { :controller => 'versions', :action => 'show', :id => '1',
909 :format => 'xml' }
910 )
911 assert_routing(
912 { :method => 'get', :path => "/versions/1.json" },
913 { :controller => 'versions', :action => 'show', :id => '1',
914 :format => 'json' }
915 )
916 assert_routing(
917 { :method => 'get', :path => "/versions/1/edit" },
918 { :controller => 'versions', :action => 'edit', :id => '1' }
919 )
920 assert_routing(
921 { :method => 'put', :path => "/versions/1" },
922 { :controller => 'versions', :action => 'update', :id => '1' }
923 )
924 assert_routing(
925 { :method => 'put', :path => "/versions/1.xml" },
926 { :controller => 'versions', :action => 'update', :id => '1',
927 :format => 'xml' }
928 )
929 assert_routing(
930 { :method => 'put', :path => "/versions/1.json" },
931 { :controller => 'versions', :action => 'update', :id => '1',
932 :format => 'json' }
933 )
934 assert_routing(
935 { :method => 'delete', :path => "/versions/1" },
936 { :controller => 'versions', :action => 'destroy', :id => '1' }
937 )
938 assert_routing(
939 { :method => 'delete', :path => "/versions/1.xml" },
940 { :controller => 'versions', :action => 'destroy', :id => '1',
941 :format => 'xml' }
942 )
943 assert_routing(
944 { :method => 'delete', :path => "/versions/1.json" },
945 { :controller => 'versions', :action => 'destroy', :id => '1',
946 :format => 'json' }
947 )
948 assert_routing(
949 { :method => 'put', :path => "/projects/foo/versions/close_completed" },
950 { :controller => 'versions', :action => 'close_completed',
951 :project_id => 'foo' }
952 )
953 assert_routing(
954 { :method => 'post', :path => "/versions/1/status_by" },
955 { :controller => 'versions', :action => 'status_by', :id => '1' }
956 )
957 end
958
959 def test_welcome
870 def test_welcome
960 assert_routing(
871 assert_routing(
961 { :method => 'get', :path => "/robots.txt" },
872 { :method => 'get', :path => "/robots.txt" },
962 { :controller => 'welcome', :action => 'robots' }
873 { :controller => 'welcome', :action => 'robots' }
963 )
874 )
964 end
875 end
965
876
966 def test_wiki_singular_projects_pages
877 def test_wiki_singular_projects_pages
967 assert_routing(
878 assert_routing(
968 { :method => 'get', :path => "/projects/567/wiki" },
879 { :method => 'get', :path => "/projects/567/wiki" },
969 { :controller => 'wiki', :action => 'show', :project_id => '567' }
880 { :controller => 'wiki', :action => 'show', :project_id => '567' }
970 )
881 )
971 assert_routing(
882 assert_routing(
972 { :method => 'get', :path => "/projects/567/wiki/lalala" },
883 { :method => 'get', :path => "/projects/567/wiki/lalala" },
973 { :controller => 'wiki', :action => 'show', :project_id => '567',
884 { :controller => 'wiki', :action => 'show', :project_id => '567',
974 :id => 'lalala' }
885 :id => 'lalala' }
975 )
886 )
976 assert_routing(
887 assert_routing(
977 { :method => 'get', :path => "/projects/567/wiki/my_page/edit" },
888 { :method => 'get', :path => "/projects/567/wiki/my_page/edit" },
978 { :controller => 'wiki', :action => 'edit', :project_id => '567',
889 { :controller => 'wiki', :action => 'edit', :project_id => '567',
979 :id => 'my_page' }
890 :id => 'my_page' }
980 )
891 )
981 assert_routing(
892 assert_routing(
982 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/history" },
893 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/history" },
983 { :controller => 'wiki', :action => 'history', :project_id => '1',
894 { :controller => 'wiki', :action => 'history', :project_id => '1',
984 :id => 'CookBook_documentation' }
895 :id => 'CookBook_documentation' }
985 )
896 )
986 assert_routing(
897 assert_routing(
987 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff" },
898 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff" },
988 { :controller => 'wiki', :action => 'diff', :project_id => '1',
899 { :controller => 'wiki', :action => 'diff', :project_id => '1',
989 :id => 'CookBook_documentation' }
900 :id => 'CookBook_documentation' }
990 )
901 )
991 assert_routing(
902 assert_routing(
992 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2" },
903 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2" },
993 { :controller => 'wiki', :action => 'diff', :project_id => '1',
904 { :controller => 'wiki', :action => 'diff', :project_id => '1',
994 :id => 'CookBook_documentation', :version => '2' }
905 :id => 'CookBook_documentation', :version => '2' }
995 )
906 )
996 assert_routing(
907 assert_routing(
997 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2/vs/1" },
908 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2/vs/1" },
998 { :controller => 'wiki', :action => 'diff', :project_id => '1',
909 { :controller => 'wiki', :action => 'diff', :project_id => '1',
999 :id => 'CookBook_documentation', :version => '2', :version_from => '1' }
910 :id => 'CookBook_documentation', :version => '2', :version_from => '1' }
1000 )
911 )
1001 assert_routing(
912 assert_routing(
1002 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/annotate/2" },
913 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/annotate/2" },
1003 { :controller => 'wiki', :action => 'annotate', :project_id => '1',
914 { :controller => 'wiki', :action => 'annotate', :project_id => '1',
1004 :id => 'CookBook_documentation', :version => '2' }
915 :id => 'CookBook_documentation', :version => '2' }
1005 )
916 )
1006 assert_routing(
917 assert_routing(
1007 { :method => 'get', :path => "/projects/22/wiki/ladida/rename" },
918 { :method => 'get', :path => "/projects/22/wiki/ladida/rename" },
1008 { :controller => 'wiki', :action => 'rename', :project_id => '22',
919 { :controller => 'wiki', :action => 'rename', :project_id => '22',
1009 :id => 'ladida' }
920 :id => 'ladida' }
1010 )
921 )
1011 assert_routing(
922 assert_routing(
1012 { :method => 'get', :path => "/projects/567/wiki/index" },
923 { :method => 'get', :path => "/projects/567/wiki/index" },
1013 { :controller => 'wiki', :action => 'index', :project_id => '567' }
924 { :controller => 'wiki', :action => 'index', :project_id => '567' }
1014 )
925 )
1015 assert_routing(
926 assert_routing(
1016 { :method => 'get', :path => "/projects/567/wiki/date_index" },
927 { :method => 'get', :path => "/projects/567/wiki/date_index" },
1017 { :controller => 'wiki', :action => 'date_index', :project_id => '567' }
928 { :controller => 'wiki', :action => 'date_index', :project_id => '567' }
1018 )
929 )
1019 assert_routing(
930 assert_routing(
1020 { :method => 'get', :path => "/projects/567/wiki/export" },
931 { :method => 'get', :path => "/projects/567/wiki/export" },
1021 { :controller => 'wiki', :action => 'export', :project_id => '567' }
932 { :controller => 'wiki', :action => 'export', :project_id => '567' }
1022 )
933 )
1023 assert_routing(
934 assert_routing(
1024 { :method => 'post', :path => "/projects/567/wiki/CookBook_documentation/preview" },
935 { :method => 'post', :path => "/projects/567/wiki/CookBook_documentation/preview" },
1025 { :controller => 'wiki', :action => 'preview', :project_id => '567',
936 { :controller => 'wiki', :action => 'preview', :project_id => '567',
1026 :id => 'CookBook_documentation' }
937 :id => 'CookBook_documentation' }
1027 )
938 )
1028 assert_routing(
939 assert_routing(
1029 { :method => 'post', :path => "/projects/22/wiki/ladida/rename" },
940 { :method => 'post', :path => "/projects/22/wiki/ladida/rename" },
1030 { :controller => 'wiki', :action => 'rename', :project_id => '22',
941 { :controller => 'wiki', :action => 'rename', :project_id => '22',
1031 :id => 'ladida' }
942 :id => 'ladida' }
1032 )
943 )
1033 assert_routing(
944 assert_routing(
1034 { :method => 'post', :path => "/projects/22/wiki/ladida/protect" },
945 { :method => 'post', :path => "/projects/22/wiki/ladida/protect" },
1035 { :controller => 'wiki', :action => 'protect', :project_id => '22',
946 { :controller => 'wiki', :action => 'protect', :project_id => '22',
1036 :id => 'ladida' }
947 :id => 'ladida' }
1037 )
948 )
1038 assert_routing(
949 assert_routing(
1039 { :method => 'post', :path => "/projects/22/wiki/ladida/add_attachment" },
950 { :method => 'post', :path => "/projects/22/wiki/ladida/add_attachment" },
1040 { :controller => 'wiki', :action => 'add_attachment', :project_id => '22',
951 { :controller => 'wiki', :action => 'add_attachment', :project_id => '22',
1041 :id => 'ladida' }
952 :id => 'ladida' }
1042 )
953 )
1043 assert_routing(
954 assert_routing(
1044 { :method => 'put', :path => "/projects/567/wiki/my_page" },
955 { :method => 'put', :path => "/projects/567/wiki/my_page" },
1045 { :controller => 'wiki', :action => 'update', :project_id => '567',
956 { :controller => 'wiki', :action => 'update', :project_id => '567',
1046 :id => 'my_page' }
957 :id => 'my_page' }
1047 )
958 )
1048 assert_routing(
959 assert_routing(
1049 { :method => 'delete', :path => "/projects/22/wiki/ladida" },
960 { :method => 'delete', :path => "/projects/22/wiki/ladida" },
1050 { :controller => 'wiki', :action => 'destroy', :project_id => '22',
961 { :controller => 'wiki', :action => 'destroy', :project_id => '22',
1051 :id => 'ladida' }
962 :id => 'ladida' }
1052 )
963 )
1053 end
964 end
1054
965
1055 def test_wikis_plural_admin_setup
966 def test_wikis_plural_admin_setup
1056 assert_routing(
967 assert_routing(
1057 { :method => 'get', :path => "/projects/ladida/wiki/destroy" },
968 { :method => 'get', :path => "/projects/ladida/wiki/destroy" },
1058 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
969 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
1059 )
970 )
1060 assert_routing(
971 assert_routing(
1061 { :method => 'post', :path => "/projects/ladida/wiki" },
972 { :method => 'post', :path => "/projects/ladida/wiki" },
1062 { :controller => 'wikis', :action => 'edit', :id => 'ladida' }
973 { :controller => 'wikis', :action => 'edit', :id => 'ladida' }
1063 )
974 )
1064 assert_routing(
975 assert_routing(
1065 { :method => 'post', :path => "/projects/ladida/wiki/destroy" },
976 { :method => 'post', :path => "/projects/ladida/wiki/destroy" },
1066 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
977 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
1067 )
978 )
1068 end
979 end
1069 end
980 end
General Comments 0
You need to be logged in to leave comments. Login now