##// END OF EJS Templates
test: route: move comments tests in news test to new file...
Toshi MARUYAMA -
r8237:79c0b8bade76
parent child
Show More
@@ -0,0 +1,32
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 RoutingCommentsTest < ActionController::IntegrationTest
21 def test_comments
22 assert_routing(
23 { :method => 'post', :path => "/news/567/comments" },
24 { :controller => 'comments', :action => 'create', :id => '567' }
25 )
26 assert_routing(
27 { :method => 'delete', :path => "/news/567/comments/15" },
28 { :controller => 'comments', :action => 'destroy', :id => '567',
29 :comment_id => '15' }
30 )
31 end
32 end
@@ -1,319 +1,310
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2011 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 require File.expand_path('../../test_helper', __FILE__)
19 19
20 20 class RoutingTest < ActionController::IntegrationTest
21 21 def test_news
22 22 assert_routing(
23 23 { :method => 'get', :path => "/news" },
24 24 { :controller => 'news', :action => 'index' }
25 25 )
26 26 assert_routing(
27 27 { :method => 'get', :path => "/news.atom" },
28 28 { :controller => 'news', :action => 'index', :format => 'atom' }
29 29 )
30 30 assert_routing(
31 31 { :method => 'get', :path => "/news.xml" },
32 32 { :controller => 'news', :action => 'index', :format => 'xml' }
33 33 )
34 34 assert_routing(
35 35 { :method => 'get', :path => "/news.json" },
36 36 { :controller => 'news', :action => 'index', :format => 'json' }
37 37 )
38 38 assert_routing(
39 39 { :method => 'get', :path => "/projects/567/news" },
40 40 { :controller => 'news', :action => 'index', :project_id => '567' }
41 41 )
42 42 assert_routing(
43 43 { :method => 'get', :path => "/projects/567/news.atom" },
44 44 { :controller => 'news', :action => 'index', :format => 'atom',
45 45 :project_id => '567' }
46 46 )
47 47 assert_routing(
48 48 { :method => 'get', :path => "/projects/567/news.xml" },
49 49 { :controller => 'news', :action => 'index', :format => 'xml',
50 50 :project_id => '567' }
51 51 )
52 52 assert_routing(
53 53 { :method => 'get', :path => "/projects/567/news.json" },
54 54 { :controller => 'news', :action => 'index', :format => 'json',
55 55 :project_id => '567' }
56 56 )
57 57 assert_routing(
58 58 { :method => 'get', :path => "/news/2" },
59 59 { :controller => 'news', :action => 'show', :id => '2' }
60 60 )
61 61 assert_routing(
62 62 { :method => 'get', :path => "/projects/567/news/new" },
63 63 { :controller => 'news', :action => 'new', :project_id => '567' }
64 64 )
65 65 assert_routing(
66 66 { :method => 'get', :path => "/news/234" },
67 67 { :controller => 'news', :action => 'show', :id => '234' }
68 68 )
69 69 assert_routing(
70 70 { :method => 'get', :path => "/news/567/edit" },
71 71 { :controller => 'news', :action => 'edit', :id => '567' }
72 72 )
73 73 assert_routing(
74 74 { :method => 'post', :path => "/projects/567/news" },
75 75 { :controller => 'news', :action => 'create', :project_id => '567' }
76 76 )
77 77 assert_routing(
78 { :method => 'post', :path => "/news/567/comments" },
79 { :controller => 'comments', :action => 'create', :id => '567' }
80 )
81 assert_routing(
82 78 { :method => 'put', :path => "/news/567" },
83 79 { :controller => 'news', :action => 'update', :id => '567' }
84 80 )
85 81 assert_routing(
86 82 { :method => 'delete', :path => "/news/567" },
87 83 { :controller => 'news', :action => 'destroy', :id => '567' }
88 84 )
89 assert_routing(
90 { :method => 'delete', :path => "/news/567/comments/15" },
91 { :controller => 'comments', :action => 'destroy', :id => '567',
92 :comment_id => '15' }
93 )
94 85 end
95 86
96 87 def test_projects
97 88 assert_routing(
98 89 { :method => 'get', :path => "/projects" },
99 90 { :controller => 'projects', :action => 'index' }
100 91 )
101 92 assert_routing(
102 93 { :method => 'get', :path => "/projects.atom" },
103 94 { :controller => 'projects', :action => 'index', :format => 'atom' }
104 95 )
105 96 assert_routing(
106 97 { :method => 'get', :path => "/projects.xml" },
107 98 { :controller => 'projects', :action => 'index', :format => 'xml' }
108 99 )
109 100 assert_routing(
110 101 { :method => 'get', :path => "/projects/new" },
111 102 { :controller => 'projects', :action => 'new' }
112 103 )
113 104 assert_routing(
114 105 { :method => 'get', :path => "/projects/test" },
115 106 { :controller => 'projects', :action => 'show', :id => 'test' }
116 107 )
117 108 assert_routing(
118 109 { :method => 'get', :path => "/projects/1.xml" },
119 110 { :controller => 'projects', :action => 'show', :id => '1',
120 111 :format => 'xml' }
121 112 )
122 113 assert_routing(
123 114 { :method => 'get', :path => "/projects/4223/settings" },
124 115 { :controller => 'projects', :action => 'settings', :id => '4223' }
125 116 )
126 117 assert_routing(
127 118 { :method => 'get', :path => "/projects/4223/settings/members" },
128 119 { :controller => 'projects', :action => 'settings', :id => '4223',
129 120 :tab => 'members' }
130 121 )
131 122 assert_routing(
132 123 { :method => 'post', :path => "/projects" },
133 124 { :controller => 'projects', :action => 'create' }
134 125 )
135 126 assert_routing(
136 127 { :method => 'post', :path => "/projects.xml" },
137 128 { :controller => 'projects', :action => 'create', :format => 'xml' }
138 129 )
139 130 assert_routing(
140 131 { :method => 'post', :path => "/projects/64/archive" },
141 132 { :controller => 'projects', :action => 'archive', :id => '64' }
142 133 )
143 134 assert_routing(
144 135 { :method => 'post', :path => "/projects/64/unarchive" },
145 136 { :controller => 'projects', :action => 'unarchive', :id => '64' }
146 137 )
147 138 assert_routing(
148 139 { :method => 'put', :path => "/projects/64/enumerations" },
149 140 { :controller => 'project_enumerations', :action => 'update',
150 141 :project_id => '64' }
151 142 )
152 143 assert_routing(
153 144 { :method => 'put', :path => "/projects/4223" },
154 145 { :controller => 'projects', :action => 'update', :id => '4223' }
155 146 )
156 147 assert_routing(
157 148 { :method => 'put', :path => "/projects/1.xml" },
158 149 { :controller => 'projects', :action => 'update', :id => '1',
159 150 :format => 'xml' }
160 151 )
161 152 assert_routing(
162 153 { :method => 'delete', :path => "/projects/64" },
163 154 { :controller => 'projects', :action => 'destroy', :id => '64' }
164 155 )
165 156 assert_routing(
166 157 { :method => 'delete', :path => "/projects/1.xml" },
167 158 { :controller => 'projects', :action => 'destroy', :id => '1',
168 159 :format => 'xml' }
169 160 )
170 161 assert_routing(
171 162 { :method => 'delete', :path => "/projects/64/enumerations" },
172 163 { :controller => 'project_enumerations', :action => 'destroy',
173 164 :project_id => '64' }
174 165 )
175 166 end
176 167
177 168 def test_queries
178 169 assert_routing(
179 170 { :method => 'get', :path => "/queries.xml" },
180 171 { :controller => 'queries', :action => 'index', :format => 'xml' }
181 172 )
182 173 assert_routing(
183 174 { :method => 'get', :path => "/queries.json" },
184 175 { :controller => 'queries', :action => 'index', :format => 'json' }
185 176 )
186 177 assert_routing(
187 178 { :method => 'get', :path => "/queries/new" },
188 179 { :controller => 'queries', :action => 'new' }
189 180 )
190 181 assert_routing(
191 182 { :method => 'get', :path => "/projects/redmine/queries/new" },
192 183 { :controller => 'queries', :action => 'new', :project_id => 'redmine' }
193 184 )
194 185 assert_routing(
195 186 { :method => 'post', :path => "/queries" },
196 187 { :controller => 'queries', :action => 'create' }
197 188 )
198 189 assert_routing(
199 190 { :method => 'post', :path => "/projects/redmine/queries" },
200 191 { :controller => 'queries', :action => 'create', :project_id => 'redmine' }
201 192 )
202 193 assert_routing(
203 194 { :method => 'get', :path => "/queries/1/edit" },
204 195 { :controller => 'queries', :action => 'edit', :id => '1' }
205 196 )
206 197 assert_routing(
207 198 { :method => 'put', :path => "/queries/1" },
208 199 { :controller => 'queries', :action => 'update', :id => '1' }
209 200 )
210 201 assert_routing(
211 202 { :method => 'delete', :path => "/queries/1" },
212 203 { :controller => 'queries', :action => 'destroy', :id => '1' }
213 204 )
214 205 end
215 206
216 207 def test_wiki_singular_projects_pages
217 208 assert_routing(
218 209 { :method => 'get', :path => "/projects/567/wiki" },
219 210 { :controller => 'wiki', :action => 'show', :project_id => '567' }
220 211 )
221 212 assert_routing(
222 213 { :method => 'get', :path => "/projects/567/wiki/lalala" },
223 214 { :controller => 'wiki', :action => 'show', :project_id => '567',
224 215 :id => 'lalala' }
225 216 )
226 217 assert_routing(
227 218 { :method => 'get', :path => "/projects/567/wiki/my_page/edit" },
228 219 { :controller => 'wiki', :action => 'edit', :project_id => '567',
229 220 :id => 'my_page' }
230 221 )
231 222 assert_routing(
232 223 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/history" },
233 224 { :controller => 'wiki', :action => 'history', :project_id => '1',
234 225 :id => 'CookBook_documentation' }
235 226 )
236 227 assert_routing(
237 228 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff" },
238 229 { :controller => 'wiki', :action => 'diff', :project_id => '1',
239 230 :id => 'CookBook_documentation' }
240 231 )
241 232 assert_routing(
242 233 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2" },
243 234 { :controller => 'wiki', :action => 'diff', :project_id => '1',
244 235 :id => 'CookBook_documentation', :version => '2' }
245 236 )
246 237 assert_routing(
247 238 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff/2/vs/1" },
248 239 { :controller => 'wiki', :action => 'diff', :project_id => '1',
249 240 :id => 'CookBook_documentation', :version => '2', :version_from => '1' }
250 241 )
251 242 assert_routing(
252 243 { :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/annotate/2" },
253 244 { :controller => 'wiki', :action => 'annotate', :project_id => '1',
254 245 :id => 'CookBook_documentation', :version => '2' }
255 246 )
256 247 assert_routing(
257 248 { :method => 'get', :path => "/projects/22/wiki/ladida/rename" },
258 249 { :controller => 'wiki', :action => 'rename', :project_id => '22',
259 250 :id => 'ladida' }
260 251 )
261 252 assert_routing(
262 253 { :method => 'get', :path => "/projects/567/wiki/index" },
263 254 { :controller => 'wiki', :action => 'index', :project_id => '567' }
264 255 )
265 256 assert_routing(
266 257 { :method => 'get', :path => "/projects/567/wiki/date_index" },
267 258 { :controller => 'wiki', :action => 'date_index', :project_id => '567' }
268 259 )
269 260 assert_routing(
270 261 { :method => 'get', :path => "/projects/567/wiki/export" },
271 262 { :controller => 'wiki', :action => 'export', :project_id => '567' }
272 263 )
273 264 assert_routing(
274 265 { :method => 'post', :path => "/projects/567/wiki/CookBook_documentation/preview" },
275 266 { :controller => 'wiki', :action => 'preview', :project_id => '567',
276 267 :id => 'CookBook_documentation' }
277 268 )
278 269 assert_routing(
279 270 { :method => 'post', :path => "/projects/22/wiki/ladida/rename" },
280 271 { :controller => 'wiki', :action => 'rename', :project_id => '22',
281 272 :id => 'ladida' }
282 273 )
283 274 assert_routing(
284 275 { :method => 'post', :path => "/projects/22/wiki/ladida/protect" },
285 276 { :controller => 'wiki', :action => 'protect', :project_id => '22',
286 277 :id => 'ladida' }
287 278 )
288 279 assert_routing(
289 280 { :method => 'post', :path => "/projects/22/wiki/ladida/add_attachment" },
290 281 { :controller => 'wiki', :action => 'add_attachment', :project_id => '22',
291 282 :id => 'ladida' }
292 283 )
293 284 assert_routing(
294 285 { :method => 'put', :path => "/projects/567/wiki/my_page" },
295 286 { :controller => 'wiki', :action => 'update', :project_id => '567',
296 287 :id => 'my_page' }
297 288 )
298 289 assert_routing(
299 290 { :method => 'delete', :path => "/projects/22/wiki/ladida" },
300 291 { :controller => 'wiki', :action => 'destroy', :project_id => '22',
301 292 :id => 'ladida' }
302 293 )
303 294 end
304 295
305 296 def test_wikis_plural_admin_setup
306 297 assert_routing(
307 298 { :method => 'get', :path => "/projects/ladida/wiki/destroy" },
308 299 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
309 300 )
310 301 assert_routing(
311 302 { :method => 'post', :path => "/projects/ladida/wiki" },
312 303 { :controller => 'wikis', :action => 'edit', :id => 'ladida' }
313 304 )
314 305 assert_routing(
315 306 { :method => 'post', :path => "/projects/ladida/wiki/destroy" },
316 307 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
317 308 )
318 309 end
319 310 end
General Comments 0
You need to be logged in to leave comments. Login now