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