##// END OF EJS Templates
test: replace "should_route" of "wikis (plural, admin setup)" to "assert_routing" at integration/routing_test.rb...
Toshi MARUYAMA -
r8096:8ac56d13d720
parent child
Show More
@@ -1,533 +1,541
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_activities
22 22 assert_routing(
23 23 { :method => 'get', :path => "/activity" },
24 24 { :controller => 'activities', :action => 'index', :id => nil }
25 25 )
26 26 assert_routing(
27 27 { :method => 'get', :path => "/activity.atom" },
28 28 { :controller => 'activities', :action => 'index', :id => nil, :format => 'atom' }
29 29 )
30 30 end
31 31
32 32 def test_attachments
33 33 assert_routing(
34 34 { :method => 'get', :path => "/attachments/1" },
35 35 { :controller => 'attachments', :action => 'show', :id => '1' }
36 36 )
37 37 assert_routing(
38 38 { :method => 'get', :path => "/attachments/1.xml" },
39 39 { :controller => 'attachments', :action => 'show', :id => '1', :format => 'xml' }
40 40 )
41 41 assert_routing(
42 42 { :method => 'get', :path => "/attachments/1.json" },
43 43 { :controller => 'attachments', :action => 'show', :id => '1', :format => 'json' }
44 44 )
45 45 assert_routing(
46 46 { :method => 'get', :path => "/attachments/1/filename.ext" },
47 47 { :controller => 'attachments', :action => 'show', :id => '1',
48 48 :filename => 'filename.ext' }
49 49 )
50 50 assert_routing(
51 51 { :method => 'get', :path => "/attachments/download/1" },
52 52 { :controller => 'attachments', :action => 'download', :id => '1' }
53 53 )
54 54 assert_routing(
55 55 { :method => 'get', :path => "/attachments/download/1/filename.ext" },
56 56 { :controller => 'attachments', :action => 'download', :id => '1',
57 57 :filename => 'filename.ext' }
58 58 )
59 59 end
60 60
61 61 def test_boards
62 62 assert_routing(
63 63 { :method => 'get', :path => "/projects/world_domination/boards" },
64 64 { :controller => 'boards', :action => 'index', :project_id => 'world_domination' }
65 65 )
66 66 assert_routing(
67 67 { :method => 'get', :path => "/projects/world_domination/boards/new" },
68 68 { :controller => 'boards', :action => 'new', :project_id => 'world_domination' }
69 69 )
70 70 assert_routing(
71 71 { :method => 'get', :path => "/projects/world_domination/boards/44" },
72 72 { :controller => 'boards', :action => 'show', :project_id => 'world_domination',
73 73 :id => '44' }
74 74 )
75 75 assert_routing(
76 76 { :method => 'get', :path => "/projects/world_domination/boards/44.atom" },
77 77 { :controller => 'boards', :action => 'show', :project_id => 'world_domination',
78 78 :id => '44', :format => 'atom' }
79 79 )
80 80 assert_routing(
81 81 { :method => 'get', :path => "/projects/world_domination/boards/44/edit" },
82 82 { :controller => 'boards', :action => 'edit', :project_id => 'world_domination',
83 83 :id => '44' }
84 84 )
85 85 assert_routing(
86 86 { :method => 'post', :path => "/projects/world_domination/boards" },
87 87 { :controller => 'boards', :action => 'create', :project_id => 'world_domination' }
88 88 )
89 89 assert_routing(
90 90 { :method => 'put', :path => "/projects/world_domination/boards/44" },
91 91 { :controller => 'boards', :action => 'update', :project_id => 'world_domination', :id => '44' }
92 92 )
93 93 assert_routing(
94 94 { :method => 'delete', :path => "/projects/world_domination/boards/44" },
95 95 { :controller => 'boards', :action => 'destroy', :project_id => 'world_domination', :id => '44' }
96 96 )
97 97 end
98 98
99 99 def test_custom_fields
100 100 assert_routing(
101 101 { :method => 'get', :path => "/custom_fields" },
102 102 { :controller => 'custom_fields', :action => 'index' }
103 103 )
104 104 assert_routing(
105 105 { :method => 'get', :path => "/custom_fields/new" },
106 106 { :controller => 'custom_fields', :action => 'new' }
107 107 )
108 108 assert_routing(
109 109 { :method => 'post', :path => "/custom_fields" },
110 110 { :controller => 'custom_fields', :action => 'create' }
111 111 )
112 112 assert_routing(
113 113 { :method => 'get', :path => "/custom_fields/2/edit" },
114 114 { :controller => 'custom_fields', :action => 'edit', :id => '2' }
115 115 )
116 116 assert_routing(
117 117 { :method => 'put', :path => "/custom_fields/2" },
118 118 { :controller => 'custom_fields', :action => 'update', :id => '2' }
119 119 )
120 120 assert_routing(
121 121 { :method => 'delete', :path => "/custom_fields/2" },
122 122 { :controller => 'custom_fields', :action => 'destroy', :id => '2' }
123 123 )
124 124 end
125 125
126 126 context "documents" do
127 127 should_route :get, "/projects/567/documents", :controller => 'documents', :action => 'index', :project_id => '567'
128 128 should_route :get, "/projects/567/documents/new", :controller => 'documents', :action => 'new', :project_id => '567'
129 129 should_route :get, "/documents/22", :controller => 'documents', :action => 'show', :id => '22'
130 130 should_route :get, "/documents/22/edit", :controller => 'documents', :action => 'edit', :id => '22'
131 131
132 132 should_route :post, "/projects/567/documents", :controller => 'documents', :action => 'create', :project_id => '567'
133 133 should_route :put, "/documents/22", :controller => 'documents', :action => 'update', :id => '22'
134 134 should_route :delete, "/documents/22", :controller => 'documents', :action => 'destroy', :id => '22'
135 135
136 136 should_route :post, "/documents/22/add_attachment", :controller => 'documents', :action => 'add_attachment', :id => '22'
137 137 end
138 138
139 139 context "roles" do
140 140 should_route :get, "/enumerations", :controller => 'enumerations', :action => 'index'
141 141 should_route :get, "/enumerations/new", :controller => 'enumerations', :action => 'new'
142 142 should_route :post, "/enumerations", :controller => 'enumerations', :action => 'create'
143 143 should_route :get, "/enumerations/2/edit", :controller => 'enumerations', :action => 'edit', :id => 2
144 144 should_route :put, "/enumerations/2", :controller => 'enumerations', :action => 'update', :id => 2
145 145 should_route :delete, "/enumerations/2", :controller => 'enumerations', :action => 'destroy', :id => 2
146 146 end
147 147
148 148 context "groups" do
149 149 should_route :post, "/groups/567/users", :controller => 'groups', :action => 'add_users', :id => '567'
150 150 should_route :delete, "/groups/567/users/12", :controller => 'groups', :action => 'remove_user', :id => '567', :user_id => '12'
151 151 end
152 152
153 153 context "issues" do
154 154 # REST actions
155 155 should_route :get, "/issues", :controller => 'issues', :action => 'index'
156 156 should_route :get, "/issues.pdf", :controller => 'issues', :action => 'index', :format => 'pdf'
157 157 should_route :get, "/issues.atom", :controller => 'issues', :action => 'index', :format => 'atom'
158 158 should_route :get, "/issues.xml", :controller => 'issues', :action => 'index', :format => 'xml'
159 159 should_route :get, "/projects/23/issues", :controller => 'issues', :action => 'index', :project_id => '23'
160 160 should_route :get, "/projects/23/issues.pdf", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'pdf'
161 161 should_route :get, "/projects/23/issues.atom", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'atom'
162 162 should_route :get, "/projects/23/issues.xml", :controller => 'issues', :action => 'index', :project_id => '23', :format => 'xml'
163 163 should_route :get, "/issues/64", :controller => 'issues', :action => 'show', :id => '64'
164 164 should_route :get, "/issues/64.pdf", :controller => 'issues', :action => 'show', :id => '64', :format => 'pdf'
165 165 should_route :get, "/issues/64.atom", :controller => 'issues', :action => 'show', :id => '64', :format => 'atom'
166 166 should_route :get, "/issues/64.xml", :controller => 'issues', :action => 'show', :id => '64', :format => 'xml'
167 167
168 168 should_route :get, "/projects/23/issues/new", :controller => 'issues', :action => 'new', :project_id => '23'
169 169 # issue form update
170 170 should_route :post, "/projects/23/issues/new", :controller => 'issues', :action => 'new', :project_id => '23'
171 171 should_route :post, "/projects/23/issues", :controller => 'issues', :action => 'create', :project_id => '23'
172 172 should_route :post, "/issues.xml", :controller => 'issues', :action => 'create', :format => 'xml'
173 173
174 174 should_route :get, "/issues/64/edit", :controller => 'issues', :action => 'edit', :id => '64'
175 175 should_route :put, "/issues/1.xml", :controller => 'issues', :action => 'update', :id => '1', :format => 'xml'
176 176
177 177 should_route :delete, "/issues/1.xml", :controller => 'issues', :action => 'destroy', :id => '1', :format => 'xml'
178 178
179 179 # Extra actions
180 180 should_route :get, "/projects/23/issues/64/copy", :controller => 'issues', :action => 'new', :project_id => '23', :copy_from => '64'
181 181
182 182 should_route :get, "/issues/move/new", :controller => 'issue_moves', :action => 'new'
183 183 should_route :post, "/issues/move", :controller => 'issue_moves', :action => 'create'
184 184
185 185 should_route :post, "/issues/1/quoted", :controller => 'journals', :action => 'new', :id => '1'
186 186
187 187 should_route :get, "/issues/calendar", :controller => 'calendars', :action => 'show'
188 188 should_route :get, "/projects/project-name/issues/calendar", :controller => 'calendars', :action => 'show', :project_id => 'project-name'
189 189
190 190 should_route :get, "/issues/gantt", :controller => 'gantts', :action => 'show'
191 191 should_route :get, "/issues/gantt.pdf", :controller => 'gantts', :action => 'show', :format => 'pdf'
192 192 should_route :get, "/projects/project-name/issues/gantt", :controller => 'gantts', :action => 'show', :project_id => 'project-name'
193 193 should_route :get, "/projects/project-name/issues/gantt.pdf", :controller => 'gantts', :action => 'show', :project_id => 'project-name', :format => 'pdf'
194 194
195 195 should_route :get, "/issues/auto_complete", :controller => 'auto_completes', :action => 'issues'
196 196
197 197 should_route :get, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123'
198 198 should_route :post, "/issues/preview/123", :controller => 'previews', :action => 'issue', :id => '123'
199 199 should_route :get, "/issues/context_menu", :controller => 'context_menus', :action => 'issues'
200 200 should_route :post, "/issues/context_menu", :controller => 'context_menus', :action => 'issues'
201 201
202 202 should_route :get, "/issues/changes", :controller => 'journals', :action => 'index'
203 203
204 204 should_route :get, "/issues/bulk_edit", :controller => 'issues', :action => 'bulk_edit'
205 205 should_route :post, "/issues/bulk_update", :controller => 'issues', :action => 'bulk_update'
206 206 end
207 207
208 208 context "issue categories" do
209 209 should_route :get, "/projects/foo/issue_categories", :controller => 'issue_categories', :action => 'index', :project_id => 'foo'
210 210 should_route :get, "/projects/foo/issue_categories.xml", :controller => 'issue_categories', :action => 'index', :project_id => 'foo', :format => 'xml'
211 211 should_route :get, "/projects/foo/issue_categories.json", :controller => 'issue_categories', :action => 'index', :project_id => 'foo', :format => 'json'
212 212
213 213 should_route :get, "/projects/foo/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'foo'
214 214
215 215 should_route :post, "/projects/foo/issue_categories", :controller => 'issue_categories', :action => 'create', :project_id => 'foo'
216 216 should_route :post, "/projects/foo/issue_categories.xml", :controller => 'issue_categories', :action => 'create', :project_id => 'foo', :format => 'xml'
217 217 should_route :post, "/projects/foo/issue_categories.json", :controller => 'issue_categories', :action => 'create', :project_id => 'foo', :format => 'json'
218 218
219 219 should_route :get, "/issue_categories/1", :controller => 'issue_categories', :action => 'show', :id => '1'
220 220 should_route :get, "/issue_categories/1.xml", :controller => 'issue_categories', :action => 'show', :id => '1', :format => 'xml'
221 221 should_route :get, "/issue_categories/1.json", :controller => 'issue_categories', :action => 'show', :id => '1', :format => 'json'
222 222
223 223 should_route :get, "/issue_categories/1/edit", :controller => 'issue_categories', :action => 'edit', :id => '1'
224 224
225 225 should_route :put, "/issue_categories/1", :controller => 'issue_categories', :action => 'update', :id => '1'
226 226 should_route :put, "/issue_categories/1.xml", :controller => 'issue_categories', :action => 'update', :id => '1', :format => 'xml'
227 227 should_route :put, "/issue_categories/1.json", :controller => 'issue_categories', :action => 'update', :id => '1', :format => 'json'
228 228
229 229 should_route :delete, "/issue_categories/1", :controller => 'issue_categories', :action => 'destroy', :id => '1'
230 230 should_route :delete, "/issue_categories/1.xml", :controller => 'issue_categories', :action => 'destroy', :id => '1', :format => 'xml'
231 231 should_route :delete, "/issue_categories/1.json", :controller => 'issue_categories', :action => 'destroy', :id => '1', :format => 'json'
232 232 end
233 233
234 234 context "issue relations" do
235 235 should_route :get, "/issues/1/relations", :controller => 'issue_relations', :action => 'index', :issue_id => '1'
236 236 should_route :get, "/issues/1/relations.xml", :controller => 'issue_relations', :action => 'index', :issue_id => '1', :format => 'xml'
237 237 should_route :get, "/issues/1/relations.json", :controller => 'issue_relations', :action => 'index', :issue_id => '1', :format => 'json'
238 238
239 239 should_route :post, "/issues/1/relations", :controller => 'issue_relations', :action => 'create', :issue_id => '1'
240 240 should_route :post, "/issues/1/relations.xml", :controller => 'issue_relations', :action => 'create', :issue_id => '1', :format => 'xml'
241 241 should_route :post, "/issues/1/relations.json", :controller => 'issue_relations', :action => 'create', :issue_id => '1', :format => 'json'
242 242
243 243 should_route :get, "/relations/23", :controller => 'issue_relations', :action => 'show', :id => '23'
244 244 should_route :get, "/relations/23.xml", :controller => 'issue_relations', :action => 'show', :id => '23', :format => 'xml'
245 245 should_route :get, "/relations/23.json", :controller => 'issue_relations', :action => 'show', :id => '23', :format => 'json'
246 246
247 247 should_route :delete, "/relations/23", :controller => 'issue_relations', :action => 'destroy', :id => '23'
248 248 should_route :delete, "/relations/23.xml", :controller => 'issue_relations', :action => 'destroy', :id => '23', :format => 'xml'
249 249 should_route :delete, "/relations/23.json", :controller => 'issue_relations', :action => 'destroy', :id => '23', :format => 'json'
250 250 end
251 251
252 252 context "issue reports" do
253 253 should_route :get, "/projects/567/issues/report", :controller => 'reports', :action => 'issue_report', :id => '567'
254 254 should_route :get, "/projects/567/issues/report/assigned_to", :controller => 'reports', :action => 'issue_report_details', :id => '567', :detail => 'assigned_to'
255 255 end
256 256
257 257 context "members" do
258 258 should_route :post, "/projects/5234/members/new", :controller => 'members', :action => 'new', :id => '5234'
259 259 end
260 260
261 261 context "messages" do
262 262 should_route :get, "/boards/22/topics/2", :controller => 'messages', :action => 'show', :id => '2', :board_id => '22'
263 263 should_route :get, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala'
264 264 should_route :get, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala'
265 265
266 266 should_route :post, "/boards/lala/topics/new", :controller => 'messages', :action => 'new', :board_id => 'lala'
267 267 should_route :post, "/boards/lala/topics/22/edit", :controller => 'messages', :action => 'edit', :id => '22', :board_id => 'lala'
268 268 should_route :post, "/boards/22/topics/555/replies", :controller => 'messages', :action => 'reply', :id => '555', :board_id => '22'
269 269 should_route :post, "/boards/22/topics/555/destroy", :controller => 'messages', :action => 'destroy', :id => '555', :board_id => '22'
270 270 end
271 271
272 272 context "news" do
273 273 should_route :get, "/news", :controller => 'news', :action => 'index'
274 274 should_route :get, "/news.atom", :controller => 'news', :action => 'index', :format => 'atom'
275 275 should_route :get, "/news.xml", :controller => 'news', :action => 'index', :format => 'xml'
276 276 should_route :get, "/news.json", :controller => 'news', :action => 'index', :format => 'json'
277 277 should_route :get, "/projects/567/news", :controller => 'news', :action => 'index', :project_id => '567'
278 278 should_route :get, "/projects/567/news.atom", :controller => 'news', :action => 'index', :format => 'atom', :project_id => '567'
279 279 should_route :get, "/projects/567/news.xml", :controller => 'news', :action => 'index', :format => 'xml', :project_id => '567'
280 280 should_route :get, "/projects/567/news.json", :controller => 'news', :action => 'index', :format => 'json', :project_id => '567'
281 281 should_route :get, "/news/2", :controller => 'news', :action => 'show', :id => '2'
282 282 should_route :get, "/projects/567/news/new", :controller => 'news', :action => 'new', :project_id => '567'
283 283 should_route :get, "/news/234", :controller => 'news', :action => 'show', :id => '234'
284 284 should_route :get, "/news/567/edit", :controller => 'news', :action => 'edit', :id => '567'
285 285 should_route :get, "/news/preview", :controller => 'previews', :action => 'news'
286 286
287 287 should_route :post, "/projects/567/news", :controller => 'news', :action => 'create', :project_id => '567'
288 288 should_route :post, "/news/567/comments", :controller => 'comments', :action => 'create', :id => '567'
289 289
290 290 should_route :put, "/news/567", :controller => 'news', :action => 'update', :id => '567'
291 291
292 292 should_route :delete, "/news/567", :controller => 'news', :action => 'destroy', :id => '567'
293 293 should_route :delete, "/news/567/comments/15", :controller => 'comments', :action => 'destroy', :id => '567', :comment_id => '15'
294 294 end
295 295
296 296 context "projects" do
297 297 should_route :get, "/projects", :controller => 'projects', :action => 'index'
298 298 should_route :get, "/projects.atom", :controller => 'projects', :action => 'index', :format => 'atom'
299 299 should_route :get, "/projects.xml", :controller => 'projects', :action => 'index', :format => 'xml'
300 300 should_route :get, "/projects/new", :controller => 'projects', :action => 'new'
301 301 should_route :get, "/projects/test", :controller => 'projects', :action => 'show', :id => 'test'
302 302 should_route :get, "/projects/1.xml", :controller => 'projects', :action => 'show', :id => '1', :format => 'xml'
303 303 should_route :get, "/projects/4223/settings", :controller => 'projects', :action => 'settings', :id => '4223'
304 304 should_route :get, "/projects/4223/settings/members", :controller => 'projects', :action => 'settings', :id => '4223', :tab => 'members'
305 305 should_route :get, "/projects/33/files", :controller => 'files', :action => 'index', :project_id => '33'
306 306 should_route :get, "/projects/33/files/new", :controller => 'files', :action => 'new', :project_id => '33'
307 307 should_route :get, "/projects/33/roadmap", :controller => 'versions', :action => 'index', :project_id => '33'
308 308 should_route :get, "/projects/33/activity", :controller => 'activities', :action => 'index', :id => '33'
309 309 should_route :get, "/projects/33/activity.atom", :controller => 'activities', :action => 'index', :id => '33', :format => 'atom'
310 310
311 311 should_route :post, "/projects", :controller => 'projects', :action => 'create'
312 312 should_route :post, "/projects.xml", :controller => 'projects', :action => 'create', :format => 'xml'
313 313 should_route :post, "/projects/33/files", :controller => 'files', :action => 'create', :project_id => '33'
314 314 should_route :post, "/projects/64/archive", :controller => 'projects', :action => 'archive', :id => '64'
315 315 should_route :post, "/projects/64/unarchive", :controller => 'projects', :action => 'unarchive', :id => '64'
316 316
317 317 should_route :put, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'update', :project_id => '64'
318 318 should_route :put, "/projects/4223", :controller => 'projects', :action => 'update', :id => '4223'
319 319 should_route :put, "/projects/1.xml", :controller => 'projects', :action => 'update', :id => '1', :format => 'xml'
320 320
321 321 should_route :delete, "/projects/64", :controller => 'projects', :action => 'destroy', :id => '64'
322 322 should_route :delete, "/projects/1.xml", :controller => 'projects', :action => 'destroy', :id => '1', :format => 'xml'
323 323 should_route :delete, "/projects/64/enumerations", :controller => 'project_enumerations', :action => 'destroy', :project_id => '64'
324 324 end
325 325
326 326 context "queries" do
327 327 should_route :get, "/queries.xml", :controller => 'queries', :action => 'index', :format => 'xml'
328 328 should_route :get, "/queries.json", :controller => 'queries', :action => 'index', :format => 'json'
329 329
330 330 should_route :get, "/queries/new", :controller => 'queries', :action => 'new'
331 331 should_route :get, "/projects/redmine/queries/new", :controller => 'queries', :action => 'new', :project_id => 'redmine'
332 332
333 333 should_route :post, "/queries", :controller => 'queries', :action => 'create'
334 334 should_route :post, "/projects/redmine/queries", :controller => 'queries', :action => 'create', :project_id => 'redmine'
335 335
336 336 should_route :get, "/queries/1/edit", :controller => 'queries', :action => 'edit', :id => '1'
337 337
338 338 should_route :put, "/queries/1", :controller => 'queries', :action => 'update', :id => '1'
339 339
340 340 should_route :delete, "/queries/1", :controller => 'queries', :action => 'destroy', :id => '1'
341 341 end
342 342
343 343 context "repositories" do
344 344 should_route :get, "/projects/redmine/repository", :controller => 'repositories', :action => 'show', :id => 'redmine'
345 345 should_route :get, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine'
346 346 should_route :get, "/projects/redmine/repository/revisions", :controller => 'repositories', :action => 'revisions', :id => 'redmine'
347 347 should_route :get, "/projects/redmine/repository/revisions.atom", :controller => 'repositories', :action => 'revisions', :id => 'redmine', :format => 'atom'
348 348 should_route :get, "/projects/redmine/repository/revisions/2457", :controller => 'repositories', :action => 'revision', :id => 'redmine', :rev => '2457'
349 349 should_route :get, "/projects/redmine/repository/revisions/2457/diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457'
350 350 should_route :get, "/projects/redmine/repository/revisions/2457/diff.diff", :controller => 'repositories', :action => 'diff', :id => 'redmine', :rev => '2457', :format => 'diff'
351 351 should_route :get, "/projects/redmine/repository/diff/path/to/file.c", :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c]
352 352 should_route :get, "/projects/redmine/repository/revisions/2/diff/path/to/file.c", :controller => 'repositories', :action => 'diff', :id => 'redmine', :path => %w[path to file.c], :rev => '2'
353 353 should_route :get, "/projects/redmine/repository/browse/path/to/file.c", :controller => 'repositories', :action => 'browse', :id => 'redmine', :path => %w[path to file.c]
354 354 should_route :get, "/projects/redmine/repository/entry/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c]
355 355 should_route :get, "/projects/redmine/repository/revisions/2/entry/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :rev => '2'
356 356 should_route :get, "/projects/redmine/repository/raw/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :format => 'raw'
357 357 should_route :get, "/projects/redmine/repository/revisions/2/raw/path/to/file.c", :controller => 'repositories', :action => 'entry', :id => 'redmine', :path => %w[path to file.c], :rev => '2', :format => 'raw'
358 358 should_route :get, "/projects/redmine/repository/annotate/path/to/file.c", :controller => 'repositories', :action => 'annotate', :id => 'redmine', :path => %w[path to file.c]
359 359 should_route :get, "/projects/redmine/repository/changes/path/to/file.c", :controller => 'repositories', :action => 'changes', :id => 'redmine', :path => %w[path to file.c]
360 360 should_route :get, "/projects/redmine/repository/statistics", :controller => 'repositories', :action => 'stats', :id => 'redmine'
361 361
362 362 should_route :post, "/projects/redmine/repository/edit", :controller => 'repositories', :action => 'edit', :id => 'redmine'
363 363 end
364 364
365 365 context "roles" do
366 366 should_route :get, "/roles", :controller => 'roles', :action => 'index'
367 367 should_route :get, "/roles/new", :controller => 'roles', :action => 'new'
368 368 should_route :post, "/roles", :controller => 'roles', :action => 'create'
369 369 should_route :get, "/roles/2/edit", :controller => 'roles', :action => 'edit', :id => 2
370 370 should_route :put, "/roles/2", :controller => 'roles', :action => 'update', :id => 2
371 371 should_route :delete, "/roles/2", :controller => 'roles', :action => 'destroy', :id => 2
372 372 should_route :get, "/roles/permissions", :controller => 'roles', :action => 'permissions'
373 373 should_route :post, "/roles/permissions", :controller => 'roles', :action => 'permissions'
374 374 end
375 375
376 376 context "timelogs (global)" do
377 377 should_route :get, "/time_entries", :controller => 'timelog', :action => 'index'
378 378 should_route :get, "/time_entries.csv", :controller => 'timelog', :action => 'index', :format => 'csv'
379 379 should_route :get, "/time_entries.atom", :controller => 'timelog', :action => 'index', :format => 'atom'
380 380 should_route :get, "/time_entries/new", :controller => 'timelog', :action => 'new'
381 381 should_route :get, "/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22'
382 382
383 383 should_route :post, "/time_entries", :controller => 'timelog', :action => 'create'
384 384
385 385 should_route :put, "/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22'
386 386
387 387 should_route :delete, "/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55'
388 388 end
389 389
390 390 context "timelogs (scoped under project)" do
391 391 should_route :get, "/projects/567/time_entries", :controller => 'timelog', :action => 'index', :project_id => '567'
392 392 should_route :get, "/projects/567/time_entries.csv", :controller => 'timelog', :action => 'index', :project_id => '567', :format => 'csv'
393 393 should_route :get, "/projects/567/time_entries.atom", :controller => 'timelog', :action => 'index', :project_id => '567', :format => 'atom'
394 394 should_route :get, "/projects/567/time_entries/new", :controller => 'timelog', :action => 'new', :project_id => '567'
395 395 should_route :get, "/projects/567/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :project_id => '567'
396 396
397 397 should_route :post, "/projects/567/time_entries", :controller => 'timelog', :action => 'create', :project_id => '567'
398 398
399 399 should_route :put, "/projects/567/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :project_id => '567'
400 400
401 401 should_route :delete, "/projects/567/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :project_id => '567'
402 402 end
403 403
404 404 context "timelogs (scoped under issues)" do
405 405 should_route :get, "/issues/234/time_entries", :controller => 'timelog', :action => 'index', :issue_id => '234'
406 406 should_route :get, "/issues/234/time_entries.csv", :controller => 'timelog', :action => 'index', :issue_id => '234', :format => 'csv'
407 407 should_route :get, "/issues/234/time_entries.atom", :controller => 'timelog', :action => 'index', :issue_id => '234', :format => 'atom'
408 408 should_route :get, "/issues/234/time_entries/new", :controller => 'timelog', :action => 'new', :issue_id => '234'
409 409 should_route :get, "/issues/234/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :issue_id => '234'
410 410
411 411 should_route :post, "/issues/234/time_entries", :controller => 'timelog', :action => 'create', :issue_id => '234'
412 412
413 413 should_route :put, "/issues/234/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :issue_id => '234'
414 414
415 415 should_route :delete, "/issues/234/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :issue_id => '234'
416 416 end
417 417
418 418 context "timelogs (scoped under project and issues)" do
419 419 should_route :get, "/projects/ecookbook/issues/234/time_entries", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook'
420 420 should_route :get, "/projects/ecookbook/issues/234/time_entries.csv", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook', :format => 'csv'
421 421 should_route :get, "/projects/ecookbook/issues/234/time_entries.atom", :controller => 'timelog', :action => 'index', :issue_id => '234', :project_id => 'ecookbook', :format => 'atom'
422 422 should_route :get, "/projects/ecookbook/issues/234/time_entries/new", :controller => 'timelog', :action => 'new', :issue_id => '234', :project_id => 'ecookbook'
423 423 should_route :get, "/projects/ecookbook/issues/234/time_entries/22/edit", :controller => 'timelog', :action => 'edit', :id => '22', :issue_id => '234', :project_id => 'ecookbook'
424 424
425 425 should_route :post, "/projects/ecookbook/issues/234/time_entries", :controller => 'timelog', :action => 'create', :issue_id => '234', :project_id => 'ecookbook'
426 426
427 427 should_route :put, "/projects/ecookbook/issues/234/time_entries/22", :controller => 'timelog', :action => 'update', :id => '22', :issue_id => '234', :project_id => 'ecookbook'
428 428
429 429 should_route :delete, "/projects/ecookbook/issues/234/time_entries/55", :controller => 'timelog', :action => 'destroy', :id => '55', :issue_id => '234', :project_id => 'ecookbook'
430 430
431 431 should_route :get, "/time_entries/report", :controller => 'timelog', :action => 'report'
432 432 should_route :get, "/projects/567/time_entries/report", :controller => 'timelog', :action => 'report', :project_id => '567'
433 433 should_route :get, "/projects/567/time_entries/report.csv", :controller => 'timelog', :action => 'report', :project_id => '567', :format => 'csv'
434 434 end
435 435
436 436 context "users" do
437 437 should_route :get, "/users", :controller => 'users', :action => 'index'
438 438 should_route :get, "/users.xml", :controller => 'users', :action => 'index', :format => 'xml'
439 439 should_route :get, "/users/44", :controller => 'users', :action => 'show', :id => '44'
440 440 should_route :get, "/users/44.xml", :controller => 'users', :action => 'show', :id => '44', :format => 'xml'
441 441 should_route :get, "/users/current", :controller => 'users', :action => 'show', :id => 'current'
442 442 should_route :get, "/users/current.xml", :controller => 'users', :action => 'show', :id => 'current', :format => 'xml'
443 443 should_route :get, "/users/new", :controller => 'users', :action => 'new'
444 444 should_route :get, "/users/444/edit", :controller => 'users', :action => 'edit', :id => '444'
445 445
446 446 should_route :post, "/users", :controller => 'users', :action => 'create'
447 447 should_route :post, "/users.xml", :controller => 'users', :action => 'create', :format => 'xml'
448 448
449 449 should_route :put, "/users/444", :controller => 'users', :action => 'update', :id => '444'
450 450 should_route :put, "/users/444.xml", :controller => 'users', :action => 'update', :id => '444', :format => 'xml'
451 451
452 452 should_route :delete, "/users/44", :controller => 'users', :action => 'destroy', :id => '44'
453 453 should_route :delete, "/users/44.xml", :controller => 'users', :action => 'destroy', :id => '44', :format => 'xml'
454 454
455 455 should_route :post, "/users/123/memberships", :controller => 'users', :action => 'edit_membership', :id => '123'
456 456 should_route :put, "/users/123/memberships/55", :controller => 'users', :action => 'edit_membership', :id => '123', :membership_id => '55'
457 457 should_route :delete, "/users/123/memberships/55", :controller => 'users', :action => 'destroy_membership', :id => '123', :membership_id => '55'
458 458 end
459 459
460 460 context "versions" do
461 461 # /projects/foo/versions is /projects/foo/roadmap
462 462 should_route :get, "/projects/foo/versions.xml", :controller => 'versions', :action => 'index', :project_id => 'foo', :format => 'xml'
463 463 should_route :get, "/projects/foo/versions.json", :controller => 'versions', :action => 'index', :project_id => 'foo', :format => 'json'
464 464
465 465 should_route :get, "/projects/foo/versions/new", :controller => 'versions', :action => 'new', :project_id => 'foo'
466 466
467 467 should_route :post, "/projects/foo/versions", :controller => 'versions', :action => 'create', :project_id => 'foo'
468 468 should_route :post, "/projects/foo/versions.xml", :controller => 'versions', :action => 'create', :project_id => 'foo', :format => 'xml'
469 469 should_route :post, "/projects/foo/versions.json", :controller => 'versions', :action => 'create', :project_id => 'foo', :format => 'json'
470 470
471 471 should_route :get, "/versions/1", :controller => 'versions', :action => 'show', :id => '1'
472 472 should_route :get, "/versions/1.xml", :controller => 'versions', :action => 'show', :id => '1', :format => 'xml'
473 473 should_route :get, "/versions/1.json", :controller => 'versions', :action => 'show', :id => '1', :format => 'json'
474 474
475 475 should_route :get, "/versions/1/edit", :controller => 'versions', :action => 'edit', :id => '1'
476 476
477 477 should_route :put, "/versions/1", :controller => 'versions', :action => 'update', :id => '1'
478 478 should_route :put, "/versions/1.xml", :controller => 'versions', :action => 'update', :id => '1', :format => 'xml'
479 479 should_route :put, "/versions/1.json", :controller => 'versions', :action => 'update', :id => '1', :format => 'json'
480 480
481 481 should_route :delete, "/versions/1", :controller => 'versions', :action => 'destroy', :id => '1'
482 482 should_route :delete, "/versions/1.xml", :controller => 'versions', :action => 'destroy', :id => '1', :format => 'xml'
483 483 should_route :delete, "/versions/1.json", :controller => 'versions', :action => 'destroy', :id => '1', :format => 'json'
484 484
485 485 should_route :put, "/projects/foo/versions/close_completed", :controller => 'versions', :action => 'close_completed', :project_id => 'foo'
486 486 should_route :post, "/versions/1/status_by", :controller => 'versions', :action => 'status_by', :id => '1'
487 487 end
488 488
489 489 def test_welcome
490 490 assert_routing(
491 491 { :method => 'get', :path => "/robots.txt" },
492 492 { :controller => 'welcome', :action => 'robots' }
493 493 )
494 494 end
495 495
496 496 context "wiki (singular, project's pages)" do
497 497 should_route :get, "/projects/567/wiki", :controller => 'wiki', :action => 'show', :project_id => '567'
498 498 should_route :get, "/projects/567/wiki/lalala", :controller => 'wiki', :action => 'show', :project_id => '567', :id => 'lalala'
499 499 should_route :get, "/projects/567/wiki/my_page/edit", :controller => 'wiki', :action => 'edit', :project_id => '567', :id => 'my_page'
500 500 should_route :get, "/projects/1/wiki/CookBook_documentation/history", :controller => 'wiki', :action => 'history', :project_id => '1', :id => 'CookBook_documentation'
501 501 should_route :get, "/projects/1/wiki/CookBook_documentation/diff", :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation'
502 502 should_route :get, "/projects/1/wiki/CookBook_documentation/diff/2", :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation', :version => '2'
503 503 should_route :get, "/projects/1/wiki/CookBook_documentation/diff/2/vs/1", :controller => 'wiki', :action => 'diff', :project_id => '1', :id => 'CookBook_documentation', :version => '2', :version_from => '1'
504 504 should_route :get, "/projects/1/wiki/CookBook_documentation/annotate/2", :controller => 'wiki', :action => 'annotate', :project_id => '1', :id => 'CookBook_documentation', :version => '2'
505 505 should_route :get, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :project_id => '22', :id => 'ladida'
506 506 should_route :get, "/projects/567/wiki/index", :controller => 'wiki', :action => 'index', :project_id => '567'
507 507 should_route :get, "/projects/567/wiki/date_index", :controller => 'wiki', :action => 'date_index', :project_id => '567'
508 508 should_route :get, "/projects/567/wiki/export", :controller => 'wiki', :action => 'export', :project_id => '567'
509 509
510 510 should_route :post, "/projects/567/wiki/CookBook_documentation/preview", :controller => 'wiki', :action => 'preview', :project_id => '567', :id => 'CookBook_documentation'
511 511 should_route :post, "/projects/22/wiki/ladida/rename", :controller => 'wiki', :action => 'rename', :project_id => '22', :id => 'ladida'
512 512 should_route :post, "/projects/22/wiki/ladida/protect", :controller => 'wiki', :action => 'protect', :project_id => '22', :id => 'ladida'
513 513 should_route :post, "/projects/22/wiki/ladida/add_attachment", :controller => 'wiki', :action => 'add_attachment', :project_id => '22', :id => 'ladida'
514 514
515 515 should_route :put, "/projects/567/wiki/my_page", :controller => 'wiki', :action => 'update', :project_id => '567', :id => 'my_page'
516 516
517 517 should_route :delete, "/projects/22/wiki/ladida", :controller => 'wiki', :action => 'destroy', :project_id => '22', :id => 'ladida'
518 518 end
519 519
520 context "wikis (plural, admin setup)" do
521 should_route :get, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida'
522
523 should_route :post, "/projects/ladida/wiki", :controller => 'wikis', :action => 'edit', :id => 'ladida'
524 should_route :post, "/projects/ladida/wiki/destroy", :controller => 'wikis', :action => 'destroy', :id => 'ladida'
520 def test_wikis_plural_admin_setup
521 assert_routing(
522 { :method => 'get', :path => "/projects/ladida/wiki/destroy" },
523 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
524 )
525 assert_routing(
526 { :method => 'post', :path => "/projects/ladida/wiki" },
527 { :controller => 'wikis', :action => 'edit', :id => 'ladida' }
528 )
529 assert_routing(
530 { :method => 'post', :path => "/projects/ladida/wiki/destroy" },
531 { :controller => 'wikis', :action => 'destroy', :id => 'ladida' }
532 )
525 533 end
526 534
527 535 def test_administration_panel
528 536 assert_routing(
529 537 { :method => 'get', :path => "/admin/projects" },
530 538 { :controller => 'admin', :action => 'projects' }
531 539 )
532 540 end
533 541 end
General Comments 0
You need to be logged in to leave comments. Login now