##// END OF EJS Templates
test: route: move previews test in test_issues_extra_actions to new file...
Toshi MARUYAMA -
r8232:3995ead92bc5
parent child
Show More
@@ -0,0 +1,31
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 RoutingPreviewsTest < ActionController::IntegrationTest
21 def test_previews
22 assert_routing(
23 { :method => 'get', :path => "/issues/preview/123" },
24 { :controller => 'previews', :action => 'issue', :id => '123' }
25 )
26 assert_routing(
27 { :method => 'post', :path => "/issues/preview/123" },
28 { :controller => 'previews', :action => 'issue', :id => '123' }
29 )
30 end
31 end
@@ -1,529 +1,521
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/preview/123" },
119 { :controller => 'previews', :action => 'issue', :id => '123' }
120 )
121 assert_routing(
122 { :method => 'post', :path => "/issues/preview/123" },
123 { :controller => 'previews', :action => 'issue', :id => '123' }
124 )
125 assert_routing(
126 { :method => 'get', :path => "/issues/context_menu" },
118 { :method => 'get', :path => "/issues/context_menu" },
127 { :controller => 'context_menus', :action => 'issues' }
119 { :controller => 'context_menus', :action => 'issues' }
128 )
120 )
129 assert_routing(
121 assert_routing(
130 { :method => 'post', :path => "/issues/context_menu" },
122 { :method => 'post', :path => "/issues/context_menu" },
131 { :controller => 'context_menus', :action => 'issues' }
123 { :controller => 'context_menus', :action => 'issues' }
132 )
124 )
133 assert_routing(
125 assert_routing(
134 { :method => 'get', :path => "/issues/bulk_edit" },
126 { :method => 'get', :path => "/issues/bulk_edit" },
135 { :controller => 'issues', :action => 'bulk_edit' }
127 { :controller => 'issues', :action => 'bulk_edit' }
136 )
128 )
137 assert_routing(
129 assert_routing(
138 { :method => 'post', :path => "/issues/bulk_update" },
130 { :method => 'post', :path => "/issues/bulk_update" },
139 { :controller => 'issues', :action => 'bulk_update' }
131 { :controller => 'issues', :action => 'bulk_update' }
140 )
132 )
141 end
133 end
142
134
143 def test_issue_categories
135 def test_issue_categories
144 assert_routing(
136 assert_routing(
145 { :method => 'get', :path => "/projects/foo/issue_categories" },
137 { :method => 'get', :path => "/projects/foo/issue_categories" },
146 { :controller => 'issue_categories', :action => 'index',
138 { :controller => 'issue_categories', :action => 'index',
147 :project_id => 'foo' }
139 :project_id => 'foo' }
148 )
140 )
149 assert_routing(
141 assert_routing(
150 { :method => 'get', :path => "/projects/foo/issue_categories.xml" },
142 { :method => 'get', :path => "/projects/foo/issue_categories.xml" },
151 { :controller => 'issue_categories', :action => 'index',
143 { :controller => 'issue_categories', :action => 'index',
152 :project_id => 'foo', :format => 'xml' }
144 :project_id => 'foo', :format => 'xml' }
153 )
145 )
154 assert_routing(
146 assert_routing(
155 { :method => 'get', :path => "/projects/foo/issue_categories.json" },
147 { :method => 'get', :path => "/projects/foo/issue_categories.json" },
156 { :controller => 'issue_categories', :action => 'index',
148 { :controller => 'issue_categories', :action => 'index',
157 :project_id => 'foo', :format => 'json' }
149 :project_id => 'foo', :format => 'json' }
158 )
150 )
159 assert_routing(
151 assert_routing(
160 { :method => 'get', :path => "/projects/foo/issue_categories/new" },
152 { :method => 'get', :path => "/projects/foo/issue_categories/new" },
161 { :controller => 'issue_categories', :action => 'new',
153 { :controller => 'issue_categories', :action => 'new',
162 :project_id => 'foo' }
154 :project_id => 'foo' }
163 )
155 )
164 assert_routing(
156 assert_routing(
165 { :method => 'post', :path => "/projects/foo/issue_categories" },
157 { :method => 'post', :path => "/projects/foo/issue_categories" },
166 { :controller => 'issue_categories', :action => 'create',
158 { :controller => 'issue_categories', :action => 'create',
167 :project_id => 'foo' }
159 :project_id => 'foo' }
168 )
160 )
169 assert_routing(
161 assert_routing(
170 { :method => 'post', :path => "/projects/foo/issue_categories.xml" },
162 { :method => 'post', :path => "/projects/foo/issue_categories.xml" },
171 { :controller => 'issue_categories', :action => 'create',
163 { :controller => 'issue_categories', :action => 'create',
172 :project_id => 'foo', :format => 'xml' }
164 :project_id => 'foo', :format => 'xml' }
173 )
165 )
174 assert_routing(
166 assert_routing(
175 { :method => 'post', :path => "/projects/foo/issue_categories.json" },
167 { :method => 'post', :path => "/projects/foo/issue_categories.json" },
176 { :controller => 'issue_categories', :action => 'create',
168 { :controller => 'issue_categories', :action => 'create',
177 :project_id => 'foo', :format => 'json' }
169 :project_id => 'foo', :format => 'json' }
178 )
170 )
179 assert_routing(
171 assert_routing(
180 { :method => 'get', :path => "/issue_categories/1" },
172 { :method => 'get', :path => "/issue_categories/1" },
181 { :controller => 'issue_categories', :action => 'show', :id => '1' }
173 { :controller => 'issue_categories', :action => 'show', :id => '1' }
182 )
174 )
183 assert_routing(
175 assert_routing(
184 { :method => 'get', :path => "/issue_categories/1.xml" },
176 { :method => 'get', :path => "/issue_categories/1.xml" },
185 { :controller => 'issue_categories', :action => 'show', :id => '1',
177 { :controller => 'issue_categories', :action => 'show', :id => '1',
186 :format => 'xml' }
178 :format => 'xml' }
187 )
179 )
188 assert_routing(
180 assert_routing(
189 { :method => 'get', :path => "/issue_categories/1.json" },
181 { :method => 'get', :path => "/issue_categories/1.json" },
190 { :controller => 'issue_categories', :action => 'show', :id => '1',
182 { :controller => 'issue_categories', :action => 'show', :id => '1',
191 :format => 'json' }
183 :format => 'json' }
192 )
184 )
193 assert_routing(
185 assert_routing(
194 { :method => 'get', :path => "/issue_categories/1/edit" },
186 { :method => 'get', :path => "/issue_categories/1/edit" },
195 { :controller => 'issue_categories', :action => 'edit', :id => '1' }
187 { :controller => 'issue_categories', :action => 'edit', :id => '1' }
196 )
188 )
197 assert_routing(
189 assert_routing(
198 { :method => 'put', :path => "/issue_categories/1" },
190 { :method => 'put', :path => "/issue_categories/1" },
199 { :controller => 'issue_categories', :action => 'update', :id => '1' }
191 { :controller => 'issue_categories', :action => 'update', :id => '1' }
200 )
192 )
201 assert_routing(
193 assert_routing(
202 { :method => 'put', :path => "/issue_categories/1.xml" },
194 { :method => 'put', :path => "/issue_categories/1.xml" },
203 { :controller => 'issue_categories', :action => 'update', :id => '1',
195 { :controller => 'issue_categories', :action => 'update', :id => '1',
204 :format => 'xml' }
196 :format => 'xml' }
205 )
197 )
206 assert_routing(
198 assert_routing(
207 { :method => 'put', :path => "/issue_categories/1.json" },
199 { :method => 'put', :path => "/issue_categories/1.json" },
208 { :controller => 'issue_categories', :action => 'update', :id => '1',
200 { :controller => 'issue_categories', :action => 'update', :id => '1',
209 :format => 'json' }
201 :format => 'json' }
210 )
202 )
211 assert_routing(
203 assert_routing(
212 { :method => 'delete', :path => "/issue_categories/1" },
204 { :method => 'delete', :path => "/issue_categories/1" },
213 { :controller => 'issue_categories', :action => 'destroy', :id => '1' }
205 { :controller => 'issue_categories', :action => 'destroy', :id => '1' }
214 )
206 )
215 assert_routing(
207 assert_routing(
216 { :method => 'delete', :path => "/issue_categories/1.xml" },
208 { :method => 'delete', :path => "/issue_categories/1.xml" },
217 { :controller => 'issue_categories', :action => 'destroy', :id => '1',
209 { :controller => 'issue_categories', :action => 'destroy', :id => '1',
218 :format => 'xml' }
210 :format => 'xml' }
219 )
211 )
220 assert_routing(
212 assert_routing(
221 { :method => 'delete', :path => "/issue_categories/1.json" },
213 { :method => 'delete', :path => "/issue_categories/1.json" },
222 { :controller => 'issue_categories', :action => 'destroy', :id => '1',
214 { :controller => 'issue_categories', :action => 'destroy', :id => '1',
223 :format => 'json' }
215 :format => 'json' }
224 )
216 )
225 end
217 end
226
218
227 def test_news
219 def test_news
228 assert_routing(
220 assert_routing(
229 { :method => 'get', :path => "/news" },
221 { :method => 'get', :path => "/news" },
230 { :controller => 'news', :action => 'index' }
222 { :controller => 'news', :action => 'index' }
231 )
223 )
232 assert_routing(
224 assert_routing(
233 { :method => 'get', :path => "/news.atom" },
225 { :method => 'get', :path => "/news.atom" },
234 { :controller => 'news', :action => 'index', :format => 'atom' }
226 { :controller => 'news', :action => 'index', :format => 'atom' }
235 )
227 )
236 assert_routing(
228 assert_routing(
237 { :method => 'get', :path => "/news.xml" },
229 { :method => 'get', :path => "/news.xml" },
238 { :controller => 'news', :action => 'index', :format => 'xml' }
230 { :controller => 'news', :action => 'index', :format => 'xml' }
239 )
231 )
240 assert_routing(
232 assert_routing(
241 { :method => 'get', :path => "/news.json" },
233 { :method => 'get', :path => "/news.json" },
242 { :controller => 'news', :action => 'index', :format => 'json' }
234 { :controller => 'news', :action => 'index', :format => 'json' }
243 )
235 )
244 assert_routing(
236 assert_routing(
245 { :method => 'get', :path => "/projects/567/news" },
237 { :method => 'get', :path => "/projects/567/news" },
246 { :controller => 'news', :action => 'index', :project_id => '567' }
238 { :controller => 'news', :action => 'index', :project_id => '567' }
247 )
239 )
248 assert_routing(
240 assert_routing(
249 { :method => 'get', :path => "/projects/567/news.atom" },
241 { :method => 'get', :path => "/projects/567/news.atom" },
250 { :controller => 'news', :action => 'index', :format => 'atom',
242 { :controller => 'news', :action => 'index', :format => 'atom',
251 :project_id => '567' }
243 :project_id => '567' }
252 )
244 )
253 assert_routing(
245 assert_routing(
254 { :method => 'get', :path => "/projects/567/news.xml" },
246 { :method => 'get', :path => "/projects/567/news.xml" },
255 { :controller => 'news', :action => 'index', :format => 'xml',
247 { :controller => 'news', :action => 'index', :format => 'xml',
256 :project_id => '567' }
248 :project_id => '567' }
257 )
249 )
258 assert_routing(
250 assert_routing(
259 { :method => 'get', :path => "/projects/567/news.json" },
251 { :method => 'get', :path => "/projects/567/news.json" },
260 { :controller => 'news', :action => 'index', :format => 'json',
252 { :controller => 'news', :action => 'index', :format => 'json',
261 :project_id => '567' }
253 :project_id => '567' }
262 )
254 )
263 assert_routing(
255 assert_routing(
264 { :method => 'get', :path => "/news/2" },
256 { :method => 'get', :path => "/news/2" },
265 { :controller => 'news', :action => 'show', :id => '2' }
257 { :controller => 'news', :action => 'show', :id => '2' }
266 )
258 )
267 assert_routing(
259 assert_routing(
268 { :method => 'get', :path => "/projects/567/news/new" },
260 { :method => 'get', :path => "/projects/567/news/new" },
269 { :controller => 'news', :action => 'new', :project_id => '567' }
261 { :controller => 'news', :action => 'new', :project_id => '567' }
270 )
262 )
271 assert_routing(
263 assert_routing(
272 { :method => 'get', :path => "/news/234" },
264 { :method => 'get', :path => "/news/234" },
273 { :controller => 'news', :action => 'show', :id => '234' }
265 { :controller => 'news', :action => 'show', :id => '234' }
274 )
266 )
275 assert_routing(
267 assert_routing(
276 { :method => 'get', :path => "/news/567/edit" },
268 { :method => 'get', :path => "/news/567/edit" },
277 { :controller => 'news', :action => 'edit', :id => '567' }
269 { :controller => 'news', :action => 'edit', :id => '567' }
278 )
270 )
279 assert_routing(
271 assert_routing(
280 { :method => 'get', :path => "/news/preview" },
272 { :method => 'get', :path => "/news/preview" },
281 { :controller => 'previews', :action => 'news' }
273 { :controller => 'previews', :action => 'news' }
282 )
274 )
283 assert_routing(
275 assert_routing(
284 { :method => 'post', :path => "/projects/567/news" },
276 { :method => 'post', :path => "/projects/567/news" },
285 { :controller => 'news', :action => 'create', :project_id => '567' }
277 { :controller => 'news', :action => 'create', :project_id => '567' }
286 )
278 )
287 assert_routing(
279 assert_routing(
288 { :method => 'post', :path => "/news/567/comments" },
280 { :method => 'post', :path => "/news/567/comments" },
289 { :controller => 'comments', :action => 'create', :id => '567' }
281 { :controller => 'comments', :action => 'create', :id => '567' }
290 )
282 )
291 assert_routing(
283 assert_routing(
292 { :method => 'put', :path => "/news/567" },
284 { :method => 'put', :path => "/news/567" },
293 { :controller => 'news', :action => 'update', :id => '567' }
285 { :controller => 'news', :action => 'update', :id => '567' }
294 )
286 )
295 assert_routing(
287 assert_routing(
296 { :method => 'delete', :path => "/news/567" },
288 { :method => 'delete', :path => "/news/567" },
297 { :controller => 'news', :action => 'destroy', :id => '567' }
289 { :controller => 'news', :action => 'destroy', :id => '567' }
298 )
290 )
299 assert_routing(
291 assert_routing(
300 { :method => 'delete', :path => "/news/567/comments/15" },
292 { :method => 'delete', :path => "/news/567/comments/15" },
301 { :controller => 'comments', :action => 'destroy', :id => '567',
293 { :controller => 'comments', :action => 'destroy', :id => '567',
302 :comment_id => '15' }
294 :comment_id => '15' }
303 )
295 )
304 end
296 end
305
297
306 def test_projects
298 def test_projects
307 assert_routing(
299 assert_routing(
308 { :method => 'get', :path => "/projects" },
300 { :method => 'get', :path => "/projects" },
309 { :controller => 'projects', :action => 'index' }
301 { :controller => 'projects', :action => 'index' }
310 )
302 )
311 assert_routing(
303 assert_routing(
312 { :method => 'get', :path => "/projects.atom" },
304 { :method => 'get', :path => "/projects.atom" },
313 { :controller => 'projects', :action => 'index', :format => 'atom' }
305 { :controller => 'projects', :action => 'index', :format => 'atom' }
314 )
306 )
315 assert_routing(
307 assert_routing(
316 { :method => 'get', :path => "/projects.xml" },
308 { :method => 'get', :path => "/projects.xml" },
317 { :controller => 'projects', :action => 'index', :format => 'xml' }
309 { :controller => 'projects', :action => 'index', :format => 'xml' }
318 )
310 )
319 assert_routing(
311 assert_routing(
320 { :method => 'get', :path => "/projects/new" },
312 { :method => 'get', :path => "/projects/new" },
321 { :controller => 'projects', :action => 'new' }
313 { :controller => 'projects', :action => 'new' }
322 )
314 )
323 assert_routing(
315 assert_routing(
324 { :method => 'get', :path => "/projects/test" },
316 { :method => 'get', :path => "/projects/test" },
325 { :controller => 'projects', :action => 'show', :id => 'test' }
317 { :controller => 'projects', :action => 'show', :id => 'test' }
326 )
318 )
327 assert_routing(
319 assert_routing(
328 { :method => 'get', :path => "/projects/1.xml" },
320 { :method => 'get', :path => "/projects/1.xml" },
329 { :controller => 'projects', :action => 'show', :id => '1',
321 { :controller => 'projects', :action => 'show', :id => '1',
330 :format => 'xml' }
322 :format => 'xml' }
331 )
323 )
332 assert_routing(
324 assert_routing(
333 { :method => 'get', :path => "/projects/4223/settings" },
325 { :method => 'get', :path => "/projects/4223/settings" },
334 { :controller => 'projects', :action => 'settings', :id => '4223' }
326 { :controller => 'projects', :action => 'settings', :id => '4223' }
335 )
327 )
336 assert_routing(
328 assert_routing(
337 { :method => 'get', :path => "/projects/4223/settings/members" },
329 { :method => 'get', :path => "/projects/4223/settings/members" },
338 { :controller => 'projects', :action => 'settings', :id => '4223',
330 { :controller => 'projects', :action => 'settings', :id => '4223',
339 :tab => 'members' }
331 :tab => 'members' }
340 )
332 )
341 assert_routing(
333 assert_routing(
342 { :method => 'post', :path => "/projects" },
334 { :method => 'post', :path => "/projects" },
343 { :controller => 'projects', :action => 'create' }
335 { :controller => 'projects', :action => 'create' }
344 )
336 )
345 assert_routing(
337 assert_routing(
346 { :method => 'post', :path => "/projects.xml" },
338 { :method => 'post', :path => "/projects.xml" },
347 { :controller => 'projects', :action => 'create', :format => 'xml' }
339 { :controller => 'projects', :action => 'create', :format => 'xml' }
348 )
340 )
349 assert_routing(
341 assert_routing(
350 { :method => 'post', :path => "/projects/64/archive" },
342 { :method => 'post', :path => "/projects/64/archive" },
351 { :controller => 'projects', :action => 'archive', :id => '64' }
343 { :controller => 'projects', :action => 'archive', :id => '64' }
352 )
344 )
353 assert_routing(
345 assert_routing(
354 { :method => 'post', :path => "/projects/64/unarchive" },
346 { :method => 'post', :path => "/projects/64/unarchive" },
355 { :controller => 'projects', :action => 'unarchive', :id => '64' }
347 { :controller => 'projects', :action => 'unarchive', :id => '64' }
356 )
348 )
357 assert_routing(
349 assert_routing(
358 { :method => 'put', :path => "/projects/64/enumerations" },
350 { :method => 'put', :path => "/projects/64/enumerations" },
359 { :controller => 'project_enumerations', :action => 'update',
351 { :controller => 'project_enumerations', :action => 'update',
360 :project_id => '64' }
352 :project_id => '64' }
361 )
353 )
362 assert_routing(
354 assert_routing(
363 { :method => 'put', :path => "/projects/4223" },
355 { :method => 'put', :path => "/projects/4223" },
364 { :controller => 'projects', :action => 'update', :id => '4223' }
356 { :controller => 'projects', :action => 'update', :id => '4223' }
365 )
357 )
366 assert_routing(
358 assert_routing(
367 { :method => 'put', :path => "/projects/1.xml" },
359 { :method => 'put', :path => "/projects/1.xml" },
368 { :controller => 'projects', :action => 'update', :id => '1',
360 { :controller => 'projects', :action => 'update', :id => '1',
369 :format => 'xml' }
361 :format => 'xml' }
370 )
362 )
371 assert_routing(
363 assert_routing(
372 { :method => 'delete', :path => "/projects/64" },
364 { :method => 'delete', :path => "/projects/64" },
373 { :controller => 'projects', :action => 'destroy', :id => '64' }
365 { :controller => 'projects', :action => 'destroy', :id => '64' }
374 )
366 )
375 assert_routing(
367 assert_routing(
376 { :method => 'delete', :path => "/projects/1.xml" },
368 { :method => 'delete', :path => "/projects/1.xml" },
377 { :controller => 'projects', :action => 'destroy', :id => '1',
369 { :controller => 'projects', :action => 'destroy', :id => '1',
378 :format => 'xml' }
370 :format => 'xml' }
379 )
371 )
380 assert_routing(
372 assert_routing(
381 { :method => 'delete', :path => "/projects/64/enumerations" },
373 { :method => 'delete', :path => "/projects/64/enumerations" },
382 { :controller => 'project_enumerations', :action => 'destroy',
374 { :controller => 'project_enumerations', :action => 'destroy',
383 :project_id => '64' }
375 :project_id => '64' }
384 )
376 )
385 end
377 end
386
378
387 def test_queries
379 def test_queries
388 assert_routing(
380 assert_routing(
389 { :method => 'get', :path => "/queries.xml" },
381 { :method => 'get', :path => "/queries.xml" },
390 { :controller => 'queries', :action => 'index', :format => 'xml' }
382 { :controller => 'queries', :action => 'index', :format => 'xml' }
391 )
383 )
392 assert_routing(
384 assert_routing(
393 { :method => 'get', :path => "/queries.json" },
385 { :method => 'get', :path => "/queries.json" },
394 { :controller => 'queries', :action => 'index', :format => 'json' }
386 { :controller => 'queries', :action => 'index', :format => 'json' }
395 )
387 )
396 assert_routing(
388 assert_routing(
397 { :method => 'get', :path => "/queries/new" },
389 { :method => 'get', :path => "/queries/new" },
398 { :controller => 'queries', :action => 'new' }
390 { :controller => 'queries', :action => 'new' }
399 )
391 )
400 assert_routing(
392 assert_routing(
401 { :method => 'get', :path => "/projects/redmine/queries/new" },
393 { :method => 'get', :path => "/projects/redmine/queries/new" },
402 { :controller => 'queries', :action => 'new', :project_id => 'redmine' }
394 { :controller => 'queries', :action => 'new', :project_id => 'redmine' }
403 )
395 )
404 assert_routing(
396 assert_routing(
405 { :method => 'post', :path => "/queries" },
397 { :method => 'post', :path => "/queries" },
406 { :controller => 'queries', :action => 'create' }
398 { :controller => 'queries', :action => 'create' }
407 )
399 )
408 assert_routing(
400 assert_routing(
409 { :method => 'post', :path => "/projects/redmine/queries" },
401 { :method => 'post', :path => "/projects/redmine/queries" },
410 { :controller => 'queries', :action => 'create', :project_id => 'redmine' }
402 { :controller => 'queries', :action => 'create', :project_id => 'redmine' }
411 )
403 )
412 assert_routing(
404 assert_routing(
413 { :method => 'get', :path => "/queries/1/edit" },
405 { :method => 'get', :path => "/queries/1/edit" },
414 { :controller => 'queries', :action => 'edit', :id => '1' }
406 { :controller => 'queries', :action => 'edit', :id => '1' }
415 )
407 )
416 assert_routing(
408 assert_routing(
417 { :method => 'put', :path => "/queries/1" },
409 { :method => 'put', :path => "/queries/1" },
418 { :controller => 'queries', :action => 'update', :id => '1' }
410 { :controller => 'queries', :action => 'update', :id => '1' }
419 )
411 )
420 assert_routing(
412 assert_routing(
421 { :method => 'delete', :path => "/queries/1" },
413 { :method => 'delete', :path => "/queries/1" },
422 { :controller => 'queries', :action => 'destroy', :id => '1' }
414 { :controller => 'queries', :action => 'destroy', :id => '1' }
423 )
415 )
424 end
416 end
425
417
426 def test_wiki_singular_projects_pages
418 def test_wiki_singular_projects_pages
427 assert_routing(
419 assert_routing(
428 { :method => 'get', :path => "/projects/567/wiki" },
420 { :method => 'get', :path => "/projects/567/wiki" },
429 { :controller => 'wiki', :action => 'show', :project_id => '567' }
421 { :controller => 'wiki', :action => 'show', :project_id => '567' }
430 )
422 )
431 assert_routing(
423 assert_routing(
432 { :method => 'get', :path => "/projects/567/wiki/lalala" },
424 { :method => 'get', :path => "/projects/567/wiki/lalala" },
433 { :controller => 'wiki', :action => 'show', :project_id => '567',
425 { :controller => 'wiki', :action => 'show', :project_id => '567',
434 :id => 'lalala' }
426 :id => 'lalala' }
435 )
427 )
436 assert_routing(
428 assert_routing(
437 { :method => 'get', :path => "/projects/567/wiki/my_page/edit" },
429 { :method => 'get', :path => "/projects/567/wiki/my_page/edit" },
438 { :controller => 'wiki', :action => 'edit', :project_id => '567',
430 { :controller => 'wiki', :action => 'edit', :project_id => '567',
439 :id => 'my_page' }
431 :id => 'my_page' }
440 )
432 )
441 assert_routing(
433 assert_routing(
442 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/history" },
434 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/history" },
443 { :controller => 'wiki', :action => 'history', :project_id => '1',
435 { :controller => 'wiki', :action => 'history', :project_id => '1',
444 :id => 'CookBook_documentation' }
436 :id => 'CookBook_documentation' }
445 )
437 )
446 assert_routing(
438 assert_routing(
447 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff" },
439 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff" },
448 { :controller => 'wiki', :action => 'diff', :project_id => '1',
440 { :controller => 'wiki', :action => 'diff', :project_id => '1',
449 :id => 'CookBook_documentation' }
441 :id => 'CookBook_documentation' }
450 )
442 )
451 assert_routing(
443 assert_routing(
452 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2" },
444 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2" },
453 { :controller => 'wiki', :action => 'diff', :project_id => '1',
445 { :controller => 'wiki', :action => 'diff', :project_id => '1',
454 :id => 'CookBook_documentation', :version => '2' }
446 :id => 'CookBook_documentation', :version => '2' }
455 )
447 )
456 assert_routing(
448 assert_routing(
457 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2/vs/1" },
449 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2/vs/1" },
458 { :controller => 'wiki', :action => 'diff', :project_id => '1',
450 { :controller => 'wiki', :action => 'diff', :project_id => '1',
459 :id => 'CookBook_documentation', :version => '2', :version_from => '1' }
451 :id => 'CookBook_documentation', :version => '2', :version_from => '1' }
460 )
452 )
461 assert_routing(
453 assert_routing(
462 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/annotate/2" },
454 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/annotate/2" },
463 { :controller => 'wiki', :action => 'annotate', :project_id => '1',
455 { :controller => 'wiki', :action => 'annotate', :project_id => '1',
464 :id => 'CookBook_documentation', :version => '2' }
456 :id => 'CookBook_documentation', :version => '2' }
465 )
457 )
466 assert_routing(
458 assert_routing(
467 { :method => 'get', :path => "/projects/22/wiki/ladida/rename" },
459 { :method => 'get', :path => "/projects/22/wiki/ladida/rename" },
468 { :controller => 'wiki', :action => 'rename', :project_id => '22',
460 { :controller => 'wiki', :action => 'rename', :project_id => '22',
469 :id => 'ladida' }
461 :id => 'ladida' }
470 )
462 )
471 assert_routing(
463 assert_routing(
472 { :method => 'get', :path => "/projects/567/wiki/index" },
464 { :method => 'get', :path => "/projects/567/wiki/index" },
473 { :controller => 'wiki', :action => 'index', :project_id => '567' }
465 { :controller => 'wiki', :action => 'index', :project_id => '567' }
474 )
466 )
475 assert_routing(
467 assert_routing(
476 { :method => 'get', :path => "/projects/567/wiki/date_index" },
468 { :method => 'get', :path => "/projects/567/wiki/date_index" },
477 { :controller => 'wiki', :action => 'date_index', :project_id => '567' }
469 { :controller => 'wiki', :action => 'date_index', :project_id => '567' }
478 )
470 )
479 assert_routing(
471 assert_routing(
480 { :method => 'get', :path => "/projects/567/wiki/export" },
472 { :method => 'get', :path => "/projects/567/wiki/export" },
481 { :controller => 'wiki', :action => 'export', :project_id => '567' }
473 { :controller => 'wiki', :action => 'export', :project_id => '567' }
482 )
474 )
483 assert_routing(
475 assert_routing(
484 { :method => 'post', :path => "/projects/567/wiki/CookBook_documentation/preview" },
476 { :method => 'post', :path => "/projects/567/wiki/CookBook_documentation/preview" },
485 { :controller => 'wiki', :action => 'preview', :project_id => '567',
477 { :controller => 'wiki', :action => 'preview', :project_id => '567',
486 :id => 'CookBook_documentation' }
478 :id => 'CookBook_documentation' }
487 )
479 )
488 assert_routing(
480 assert_routing(
489 { :method => 'post', :path => "/projects/22/wiki/ladida/rename" },
481 { :method => 'post', :path => "/projects/22/wiki/ladida/rename" },
490 { :controller => 'wiki', :action => 'rename', :project_id => '22',
482 { :controller => 'wiki', :action => 'rename', :project_id => '22',
491 :id => 'ladida' }
483 :id => 'ladida' }
492 )
484 )
493 assert_routing(
485 assert_routing(
494 { :method => 'post', :path => "/projects/22/wiki/ladida/protect" },
486 { :method => 'post', :path => "/projects/22/wiki/ladida/protect" },
495 { :controller => 'wiki', :action => 'protect', :project_id => '22',
487 { :controller => 'wiki', :action => 'protect', :project_id => '22',
496 :id => 'ladida' }
488 :id => 'ladida' }
497 )
489 )
498 assert_routing(
490 assert_routing(
499 { :method => 'post', :path => "/projects/22/wiki/ladida/add_attachment" },
491 { :method => 'post', :path => "/projects/22/wiki/ladida/add_attachment" },
500 { :controller => 'wiki', :action => 'add_attachment', :project_id => '22',
492 { :controller => 'wiki', :action => 'add_attachment', :project_id => '22',
501 :id => 'ladida' }
493 :id => 'ladida' }
502 )
494 )
503 assert_routing(
495 assert_routing(
504 { :method => 'put', :path => "/projects/567/wiki/my_page" },
496 { :method => 'put', :path => "/projects/567/wiki/my_page" },
505 { :controller => 'wiki', :action => 'update', :project_id => '567',
497 { :controller => 'wiki', :action => 'update', :project_id => '567',
506 :id => 'my_page' }
498 :id => 'my_page' }
507 )
499 )
508 assert_routing(
500 assert_routing(
509 { :method => 'delete', :path => "/projects/22/wiki/ladida" },
501 { :method => 'delete', :path => "/projects/22/wiki/ladida" },
510 { :controller => 'wiki', :action => 'destroy', :project_id => '22',
502 { :controller => 'wiki', :action => 'destroy', :project_id => '22',
511 :id => 'ladida' }
503 :id => 'ladida' }
512 )
504 )
513 end
505 end
514
506
515 def test_wikis_plural_admin_setup
507 def test_wikis_plural_admin_setup
516 assert_routing(
508 assert_routing(
517 { :method => 'get', :path => "/projects/ladida/wiki/destroy" },
509 { :method => 'get', :path => "/projects/ladida/wiki/destroy" },
518 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
510 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
519 )
511 )
520 assert_routing(
512 assert_routing(
521 { :method => 'post', :path => "/projects/ladida/wiki" },
513 { :method => 'post', :path => "/projects/ladida/wiki" },
522 { :controller => 'wikis', :action => 'edit', :id => 'ladida' }
514 { :controller => 'wikis', :action => 'edit', :id => 'ladida' }
523 )
515 )
524 assert_routing(
516 assert_routing(
525 { :method => 'post', :path => "/projects/ladida/wiki/destroy" },
517 { :method => 'post', :path => "/projects/ladida/wiki/destroy" },
526 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
518 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
527 )
519 )
528 end
520 end
529 end
521 end
General Comments 0
You need to be logged in to leave comments. Login now