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