Commit f4b14494ef6abf3d144c28e4af0c20143383e062
1 parent
b24346fa
Exists in
master
and in
4 other branches
Move project-related routing specs to their own file
Showing
2 changed files
with
398 additions
and
397 deletions
Show diff stats
... | ... | @@ -0,0 +1,398 @@ |
1 | +require 'spec_helper' | |
2 | + | |
3 | +# Shared examples for a resource inside a Project | |
4 | +# | |
5 | +# By default it tests all the default REST actions: index, create, new, edit, | |
6 | +# show, update, and destroy. You can remove actions by customizing the | |
7 | +# `actions` variable. | |
8 | +# | |
9 | +# It also expects a `controller` variable to be available which defines both | |
10 | +# the path to the resource as well as the controller name. | |
11 | +# | |
12 | +# Examples | |
13 | +# | |
14 | +# # Default behavior | |
15 | +# it_behaves_like "RESTful project resources" do | |
16 | +# let(:controller) { 'issues' } | |
17 | +# end | |
18 | +# | |
19 | +# # Customizing actions | |
20 | +# it_behaves_like "RESTful project resources" do | |
21 | +# let(:actions) { [:index] } | |
22 | +# let(:controller) { 'issues' } | |
23 | +# end | |
24 | +shared_examples "RESTful project resources" do | |
25 | + let(:actions) { [:index, :create, :new, :edit, :show, :update, :destroy] } | |
26 | + | |
27 | + it "to #index" do | |
28 | + get("/gitlabhq/#{controller}").should route_to("#{controller}#index", project_id: 'gitlabhq') if actions.include?(:index) | |
29 | + end | |
30 | + | |
31 | + it "to #create" do | |
32 | + post("/gitlabhq/#{controller}").should route_to("#{controller}#create", project_id: 'gitlabhq') if actions.include?(:create) | |
33 | + end | |
34 | + | |
35 | + it "to #new" do | |
36 | + get("/gitlabhq/#{controller}/new").should route_to("#{controller}#new", project_id: 'gitlabhq') if actions.include?(:new) | |
37 | + end | |
38 | + | |
39 | + it "to #edit" do | |
40 | + get("/gitlabhq/#{controller}/1/edit").should route_to("#{controller}#edit", project_id: 'gitlabhq', id: '1') if actions.include?(:edit) | |
41 | + end | |
42 | + | |
43 | + it "to #show" do | |
44 | + get("/gitlabhq/#{controller}/1").should route_to("#{controller}#show", project_id: 'gitlabhq', id: '1') if actions.include?(:show) | |
45 | + end | |
46 | + | |
47 | + it "to #update" do | |
48 | + put("/gitlabhq/#{controller}/1").should route_to("#{controller}#update", project_id: 'gitlabhq', id: '1') if actions.include?(:update) | |
49 | + end | |
50 | + | |
51 | + it "to #destroy" do | |
52 | + delete("/gitlabhq/#{controller}/1").should route_to("#{controller}#destroy", project_id: 'gitlabhq', id: '1') if actions.include?(:destroy) | |
53 | + end | |
54 | +end | |
55 | + | |
56 | +# projects POST /projects(.:format) projects#create | |
57 | +# new_project GET /projects/new(.:format) projects#new | |
58 | +# wall_project GET /:id/wall(.:format) projects#wall | |
59 | +# graph_project GET /:id/graph(.:format) projects#graph | |
60 | +# files_project GET /:id/files(.:format) projects#files | |
61 | +# edit_project GET /:id/edit(.:format) projects#edit | |
62 | +# project GET /:id(.:format) projects#show | |
63 | +# PUT /:id(.:format) projects#update | |
64 | +# DELETE /:id(.:format) projects#destroy | |
65 | +describe ProjectsController, "routing" do | |
66 | + it "to #create" do | |
67 | + post("/projects").should route_to('projects#create') | |
68 | + end | |
69 | + | |
70 | + it "to #new" do | |
71 | + get("/projects/new").should route_to('projects#new') | |
72 | + end | |
73 | + | |
74 | + it "to #wall" do | |
75 | + get("/gitlabhq/wall").should route_to('projects#wall', id: 'gitlabhq') | |
76 | + end | |
77 | + | |
78 | + it "to #graph" do | |
79 | + get("/gitlabhq/graph").should route_to('projects#graph', id: 'gitlabhq') | |
80 | + end | |
81 | + | |
82 | + it "to #files" do | |
83 | + get("/gitlabhq/files").should route_to('projects#files', id: 'gitlabhq') | |
84 | + end | |
85 | + | |
86 | + it "to #edit" do | |
87 | + get("/gitlabhq/edit").should route_to('projects#edit', id: 'gitlabhq') | |
88 | + end | |
89 | + | |
90 | + it "to #show" do | |
91 | + get("/gitlabhq").should route_to('projects#show', id: 'gitlabhq') | |
92 | + end | |
93 | + | |
94 | + it "to #update" do | |
95 | + put("/gitlabhq").should route_to('projects#update', id: 'gitlabhq') | |
96 | + end | |
97 | + | |
98 | + it "to #destroy" do | |
99 | + delete("/gitlabhq").should route_to('projects#destroy', id: 'gitlabhq') | |
100 | + end | |
101 | +end | |
102 | + | |
103 | +# pages_project_wikis GET /:project_id/wikis/pages(.:format) wikis#pages | |
104 | +# history_project_wiki GET /:project_id/wikis/:id/history(.:format) wikis#history | |
105 | +# project_wikis POST /:project_id/wikis(.:format) wikis#create | |
106 | +# edit_project_wiki GET /:project_id/wikis/:id/edit(.:format) wikis#edit | |
107 | +# project_wiki GET /:project_id/wikis/:id(.:format) wikis#show | |
108 | +# DELETE /:project_id/wikis/:id(.:format) wikis#destroy | |
109 | +describe WikisController, "routing" do | |
110 | + it "to #pages" do | |
111 | + get("/gitlabhq/wikis/pages").should route_to('wikis#pages', project_id: 'gitlabhq') | |
112 | + end | |
113 | + | |
114 | + it "to #history" do | |
115 | + get("/gitlabhq/wikis/1/history").should route_to('wikis#history', project_id: 'gitlabhq', id: '1') | |
116 | + end | |
117 | + | |
118 | + it_behaves_like "RESTful project resources" do | |
119 | + let(:actions) { [:create, :edit, :show, :destroy] } | |
120 | + let(:controller) { 'wikis' } | |
121 | + end | |
122 | +end | |
123 | + | |
124 | +# branches_project_repository GET /:project_id/repository/branches(.:format) repositories#branches | |
125 | +# tags_project_repository GET /:project_id/repository/tags(.:format) repositories#tags | |
126 | +# archive_project_repository GET /:project_id/repository/archive(.:format) repositories#archive | |
127 | +# project_repository POST /:project_id/repository(.:format) repositories#create | |
128 | +# new_project_repository GET /:project_id/repository/new(.:format) repositories#new | |
129 | +# edit_project_repository GET /:project_id/repository/edit(.:format) repositories#edit | |
130 | +# GET /:project_id/repository(.:format) repositories#show | |
131 | +# PUT /:project_id/repository(.:format) repositories#update | |
132 | +# DELETE /:project_id/repository(.:format) repositories#destroy | |
133 | +describe RepositoriesController, "routing" do | |
134 | + it "to #branches" do | |
135 | + get("/gitlabhq/repository/branches").should route_to('repositories#branches', project_id: 'gitlabhq') | |
136 | + end | |
137 | + | |
138 | + it "to #tags" do | |
139 | + get("/gitlabhq/repository/tags").should route_to('repositories#tags', project_id: 'gitlabhq') | |
140 | + end | |
141 | + | |
142 | + it "to #archive" do | |
143 | + get("/gitlabhq/repository/archive").should route_to('repositories#archive', project_id: 'gitlabhq') | |
144 | + end | |
145 | + | |
146 | + it "to #create" do | |
147 | + post("/gitlabhq/repository").should route_to('repositories#create', project_id: 'gitlabhq') | |
148 | + end | |
149 | + | |
150 | + it "to #new" do | |
151 | + get("/gitlabhq/repository/new").should route_to('repositories#new', project_id: 'gitlabhq') | |
152 | + end | |
153 | + | |
154 | + it "to #edit" do | |
155 | + get("/gitlabhq/repository/edit").should route_to('repositories#edit', project_id: 'gitlabhq') | |
156 | + end | |
157 | + | |
158 | + it "to #show" do | |
159 | + get("/gitlabhq/repository").should route_to('repositories#show', project_id: 'gitlabhq') | |
160 | + end | |
161 | + | |
162 | + it "to #update" do | |
163 | + put("/gitlabhq/repository").should route_to('repositories#update', project_id: 'gitlabhq') | |
164 | + end | |
165 | + | |
166 | + it "to #destroy" do | |
167 | + delete("/gitlabhq/repository").should route_to('repositories#destroy', project_id: 'gitlabhq') | |
168 | + end | |
169 | +end | |
170 | + | |
171 | +# project_deploy_keys GET /:project_id/deploy_keys(.:format) deploy_keys#index | |
172 | +# POST /:project_id/deploy_keys(.:format) deploy_keys#create | |
173 | +# new_project_deploy_key GET /:project_id/deploy_keys/new(.:format) deploy_keys#new | |
174 | +# edit_project_deploy_key GET /:project_id/deploy_keys/:id/edit(.:format) deploy_keys#edit | |
175 | +# project_deploy_key GET /:project_id/deploy_keys/:id(.:format) deploy_keys#show | |
176 | +# PUT /:project_id/deploy_keys/:id(.:format) deploy_keys#update | |
177 | +# DELETE /:project_id/deploy_keys/:id(.:format) deploy_keys#destroy | |
178 | +describe DeployKeysController, "routing" do | |
179 | + it_behaves_like "RESTful project resources" do | |
180 | + let(:controller) { 'deploy_keys' } | |
181 | + end | |
182 | +end | |
183 | + | |
184 | +# project_protected_branches GET /:project_id/protected_branches(.:format) protected_branches#index | |
185 | +# POST /:project_id/protected_branches(.:format) protected_branches#create | |
186 | +# project_protected_branch DELETE /:project_id/protected_branches/:id(.:format) protected_branches#destroy | |
187 | +describe ProtectedBranchesController, "routing" do | |
188 | + it_behaves_like "RESTful project resources" do | |
189 | + let(:actions) { [:index, :create, :destroy] } | |
190 | + let(:controller) { 'protected_branches' } | |
191 | + end | |
192 | +end | |
193 | + | |
194 | +# switch_project_refs GET /:project_id/switch(.:format) refs#switch | |
195 | +# tree_project_ref GET /:project_id/:id/tree(.:format) refs#tree | |
196 | +# logs_tree_project_ref GET /:project_id/:id/logs_tree(.:format) refs#logs_tree | |
197 | +# blob_project_ref GET /:project_id/:id/blob(.:format) refs#blob | |
198 | +# tree_file_project_ref GET /:project_id/:id/tree/:path(.:format) refs#tree | |
199 | +# logs_file_project_ref GET /:project_id/:id/logs_tree/:path(.:format) refs#logs_tree | |
200 | +# blame_file_project_ref GET /:project_id/:id/blame/:path(.:format) refs#blame | |
201 | +describe RefsController, "routing" do | |
202 | + it "to #switch" do | |
203 | + get("/gitlabhq/switch").should route_to('refs#switch', project_id: 'gitlabhq') | |
204 | + end | |
205 | + | |
206 | + it "to #tree" do | |
207 | + get("/gitlabhq/stable/tree").should route_to('refs#tree', project_id: 'gitlabhq', id: 'stable') | |
208 | + get("/gitlabhq/stable/tree/foo/bar/baz").should route_to('refs#tree', project_id: 'gitlabhq', id: 'stable', path: 'foo/bar/baz') | |
209 | + end | |
210 | + | |
211 | + it "to #logs_tree" do | |
212 | + get("/gitlabhq/stable/logs_tree").should route_to('refs#logs_tree', project_id: 'gitlabhq', id: 'stable') | |
213 | + get("/gitlabhq/stable/logs_tree/foo/bar/baz").should route_to('refs#logs_tree', project_id: 'gitlabhq', id: 'stable', path: 'foo/bar/baz') | |
214 | + end | |
215 | + | |
216 | + it "to #blob" do | |
217 | + get("/gitlabhq/stable/blob").should route_to('refs#blob', project_id: 'gitlabhq', id: 'stable') | |
218 | + end | |
219 | + | |
220 | + it "to #blame" do | |
221 | + get("/gitlabhq/stable/blame/foo/bar/baz").should route_to('refs#blame', project_id: 'gitlabhq', id: 'stable', path: 'foo/bar/baz') | |
222 | + end | |
223 | +end | |
224 | + | |
225 | +# diffs_project_merge_request GET /:project_id/merge_requests/:id/diffs(.:format) merge_requests#diffs | |
226 | +# automerge_project_merge_request GET /:project_id/merge_requests/:id/automerge(.:format) merge_requests#automerge | |
227 | +# automerge_check_project_merge_request GET /:project_id/merge_requests/:id/automerge_check(.:format) merge_requests#automerge_check | |
228 | +# raw_project_merge_request GET /:project_id/merge_requests/:id/raw(.:format) merge_requests#raw | |
229 | +# branch_from_project_merge_requests GET /:project_id/merge_requests/branch_from(.:format) merge_requests#branch_from | |
230 | +# branch_to_project_merge_requests GET /:project_id/merge_requests/branch_to(.:format) merge_requests#branch_to | |
231 | +# project_merge_requests GET /:project_id/merge_requests(.:format) merge_requests#index | |
232 | +# POST /:project_id/merge_requests(.:format) merge_requests#create | |
233 | +# new_project_merge_request GET /:project_id/merge_requests/new(.:format) merge_requests#new | |
234 | +# edit_project_merge_request GET /:project_id/merge_requests/:id/edit(.:format) merge_requests#edit | |
235 | +# project_merge_request GET /:project_id/merge_requests/:id(.:format) merge_requests#show | |
236 | +# PUT /:project_id/merge_requests/:id(.:format) merge_requests#update | |
237 | +# DELETE /:project_id/merge_requests/:id(.:format) merge_requests#destroy | |
238 | +describe MergeRequestsController, "routing" do | |
239 | + it "to #diffs" do | |
240 | + get("/gitlabhq/merge_requests/1/diffs").should route_to('merge_requests#diffs', project_id: 'gitlabhq', id: '1') | |
241 | + end | |
242 | + | |
243 | + it "to #automerge" do | |
244 | + get("/gitlabhq/merge_requests/1/automerge").should route_to('merge_requests#automerge', project_id: 'gitlabhq', id: '1') | |
245 | + end | |
246 | + | |
247 | + it "to #automerge_check" do | |
248 | + get("/gitlabhq/merge_requests/1/automerge_check").should route_to('merge_requests#automerge_check', project_id: 'gitlabhq', id: '1') | |
249 | + end | |
250 | + | |
251 | + it "to #raw" do | |
252 | + get("/gitlabhq/merge_requests/1/raw").should route_to('merge_requests#raw', project_id: 'gitlabhq', id: '1') | |
253 | + end | |
254 | + | |
255 | + it "to #branch_from" do | |
256 | + get("/gitlabhq/merge_requests/branch_from").should route_to('merge_requests#branch_from', project_id: 'gitlabhq') | |
257 | + end | |
258 | + | |
259 | + it "to #branch_to" do | |
260 | + get("/gitlabhq/merge_requests/branch_to").should route_to('merge_requests#branch_to', project_id: 'gitlabhq') | |
261 | + end | |
262 | + | |
263 | + it_behaves_like "RESTful project resources" do | |
264 | + let(:controller) { 'merge_requests' } | |
265 | + end | |
266 | +end | |
267 | + | |
268 | +# raw_project_snippet GET /:project_id/snippets/:id/raw(.:format) snippets#raw | |
269 | +# project_snippets GET /:project_id/snippets(.:format) snippets#index | |
270 | +# POST /:project_id/snippets(.:format) snippets#create | |
271 | +# new_project_snippet GET /:project_id/snippets/new(.:format) snippets#new | |
272 | +# edit_project_snippet GET /:project_id/snippets/:id/edit(.:format) snippets#edit | |
273 | +# project_snippet GET /:project_id/snippets/:id(.:format) snippets#show | |
274 | +# PUT /:project_id/snippets/:id(.:format) snippets#update | |
275 | +# DELETE /:project_id/snippets/:id(.:format) snippets#destroy | |
276 | +describe SnippetsController, "routing" do | |
277 | + it "to #raw" do | |
278 | + get("/gitlabhq/snippets/1/raw").should route_to('snippets#raw', project_id: 'gitlabhq', id: '1') | |
279 | + end | |
280 | + | |
281 | + it_behaves_like "RESTful project resources" do | |
282 | + let(:controller) { 'snippets' } | |
283 | + end | |
284 | +end | |
285 | + | |
286 | +# test_project_hook GET /:project_id/hooks/:id/test(.:format) hooks#test | |
287 | +# project_hooks GET /:project_id/hooks(.:format) hooks#index | |
288 | +# POST /:project_id/hooks(.:format) hooks#create | |
289 | +# project_hook DELETE /:project_id/hooks/:id(.:format) hooks#destroy | |
290 | +describe HooksController, "routing" do | |
291 | + it "to #test" do | |
292 | + get("/gitlabhq/hooks/1/test").should route_to('hooks#test', project_id: 'gitlabhq', id: '1') | |
293 | + end | |
294 | + | |
295 | + it_behaves_like "RESTful project resources" do | |
296 | + let(:actions) { [:index, :create, :destroy] } | |
297 | + let(:controller) { 'hooks' } | |
298 | + end | |
299 | +end | |
300 | + | |
301 | +# compare_project_commits GET /:project_id/commits/compare(.:format) commits#compare | |
302 | +# patch_project_commit GET /:project_id/commits/:id/patch(.:format) commits#patch | |
303 | +# project_commits GET /:project_id/commits(.:format) commits#index | |
304 | +# POST /:project_id/commits(.:format) commits#create | |
305 | +# new_project_commit GET /:project_id/commits/new(.:format) commits#new | |
306 | +# edit_project_commit GET /:project_id/commits/:id/edit(.:format) commits#edit | |
307 | +# project_commit GET /:project_id/commits/:id(.:format) commits#show | |
308 | +# PUT /:project_id/commits/:id(.:format) commits#update | |
309 | +# DELETE /:project_id/commits/:id(.:format) commits#destroy | |
310 | +describe CommitsController, "routing" do | |
311 | + it "to #compare" do | |
312 | + get("/gitlabhq/commits/compare").should route_to('commits#compare', project_id: 'gitlabhq') | |
313 | + end | |
314 | + | |
315 | + it "to #patch" do | |
316 | + get("/gitlabhq/commits/1/patch").should route_to('commits#patch', project_id: 'gitlabhq', id: '1') | |
317 | + end | |
318 | + | |
319 | + it_behaves_like "RESTful project resources" do | |
320 | + let(:controller) { 'commits' } | |
321 | + end | |
322 | +end | |
323 | + | |
324 | +# project_team_members GET /:project_id/team_members(.:format) team_members#index | |
325 | +# POST /:project_id/team_members(.:format) team_members#create | |
326 | +# new_project_team_member GET /:project_id/team_members/new(.:format) team_members#new | |
327 | +# edit_project_team_member GET /:project_id/team_members/:id/edit(.:format) team_members#edit | |
328 | +# project_team_member GET /:project_id/team_members/:id(.:format) team_members#show | |
329 | +# PUT /:project_id/team_members/:id(.:format) team_members#update | |
330 | +# DELETE /:project_id/team_members/:id(.:format) team_members#destroy | |
331 | +describe TeamMembersController, "routing" do | |
332 | + it_behaves_like "RESTful project resources" do | |
333 | + let(:controller) { 'team_members' } | |
334 | + end | |
335 | +end | |
336 | + | |
337 | +# project_milestones GET /:project_id/milestones(.:format) milestones#index | |
338 | +# POST /:project_id/milestones(.:format) milestones#create | |
339 | +# new_project_milestone GET /:project_id/milestones/new(.:format) milestones#new | |
340 | +# edit_project_milestone GET /:project_id/milestones/:id/edit(.:format) milestones#edit | |
341 | +# project_milestone GET /:project_id/milestones/:id(.:format) milestones#show | |
342 | +# PUT /:project_id/milestones/:id(.:format) milestones#update | |
343 | +# DELETE /:project_id/milestones/:id(.:format) milestones#destroy | |
344 | +describe MilestonesController, "routing" do | |
345 | + it_behaves_like "RESTful project resources" do | |
346 | + let(:controller) { 'milestones' } | |
347 | + end | |
348 | +end | |
349 | + | |
350 | +# project_labels GET /:project_id/labels(.:format) labels#index | |
351 | +describe LabelsController, "routing" do | |
352 | + it "to #index" do | |
353 | + get("/gitlabhq/labels").should route_to('labels#index', project_id: 'gitlabhq') | |
354 | + end | |
355 | +end | |
356 | + | |
357 | +# sort_project_issues POST /:project_id/issues/sort(.:format) issues#sort | |
358 | +# bulk_update_project_issues POST /:project_id/issues/bulk_update(.:format) issues#bulk_update | |
359 | +# search_project_issues GET /:project_id/issues/search(.:format) issues#search | |
360 | +# project_issues GET /:project_id/issues(.:format) issues#index | |
361 | +# POST /:project_id/issues(.:format) issues#create | |
362 | +# new_project_issue GET /:project_id/issues/new(.:format) issues#new | |
363 | +# edit_project_issue GET /:project_id/issues/:id/edit(.:format) issues#edit | |
364 | +# project_issue GET /:project_id/issues/:id(.:format) issues#show | |
365 | +# PUT /:project_id/issues/:id(.:format) issues#update | |
366 | +# DELETE /:project_id/issues/:id(.:format) issues#destroy | |
367 | +describe IssuesController, "routing" do | |
368 | + it "to #sort" do | |
369 | + post("/gitlabhq/issues/sort").should route_to('issues#sort', project_id: 'gitlabhq') | |
370 | + end | |
371 | + | |
372 | + it "to #bulk_update" do | |
373 | + post("/gitlabhq/issues/bulk_update").should route_to('issues#bulk_update', project_id: 'gitlabhq') | |
374 | + end | |
375 | + | |
376 | + it "to #search" do | |
377 | + get("/gitlabhq/issues/search").should route_to('issues#search', project_id: 'gitlabhq') | |
378 | + end | |
379 | + | |
380 | + it_behaves_like "RESTful project resources" do | |
381 | + let(:controller) { 'issues' } | |
382 | + end | |
383 | +end | |
384 | + | |
385 | +# preview_project_notes POST /:project_id/notes/preview(.:format) notes#preview | |
386 | +# project_notes GET /:project_id/notes(.:format) notes#index | |
387 | +# POST /:project_id/notes(.:format) notes#create | |
388 | +# project_note DELETE /:project_id/notes/:id(.:format) notes#destroy | |
389 | +describe NotesController, "routing" do | |
390 | + it "to #preview" do | |
391 | + post("/gitlabhq/notes/preview").should route_to('notes#preview', project_id: 'gitlabhq') | |
392 | + end | |
393 | + | |
394 | + it_behaves_like "RESTful project resources" do | |
395 | + let(:actions) { [:index, :create, :destroy] } | |
396 | + let(:controller) { 'notes' } | |
397 | + end | |
398 | +end | ... | ... |
spec/routing/routing_spec.rb
1 | 1 | require 'spec_helper' |
2 | 2 | |
3 | -# Shared examples for a resource inside a Project | |
4 | -# | |
5 | -# By default it tests all the default REST actions: index, create, new, edit, | |
6 | -# show, update, and destroy. You can remove actions by customizing the | |
7 | -# `actions` variable. | |
8 | -# | |
9 | -# It also expects a `controller` variable to be available which defines both | |
10 | -# the path to the resource as well as the controller name. | |
11 | -# | |
12 | -# Examples | |
13 | -# | |
14 | -# # Default behavior | |
15 | -# it_behaves_like "RESTful project resources" do | |
16 | -# let(:controller) { 'issues' } | |
17 | -# end | |
18 | -# | |
19 | -# # Customizing actions | |
20 | -# it_behaves_like "RESTful project resources" do | |
21 | -# let(:actions) { [:index] } | |
22 | -# let(:controller) { 'issues' } | |
23 | -# end | |
24 | -shared_examples "RESTful project resources" do | |
25 | - let(:actions) { [:index, :create, :new, :edit, :show, :update, :destroy] } | |
26 | - | |
27 | - it "to #index" do | |
28 | - get("/gitlabhq/#{controller}").should route_to("#{controller}#index", project_id: 'gitlabhq') if actions.include?(:index) | |
29 | - end | |
30 | - | |
31 | - it "to #create" do | |
32 | - post("/gitlabhq/#{controller}").should route_to("#{controller}#create", project_id: 'gitlabhq') if actions.include?(:create) | |
33 | - end | |
34 | - | |
35 | - it "to #new" do | |
36 | - get("/gitlabhq/#{controller}/new").should route_to("#{controller}#new", project_id: 'gitlabhq') if actions.include?(:new) | |
37 | - end | |
38 | - | |
39 | - it "to #edit" do | |
40 | - get("/gitlabhq/#{controller}/1/edit").should route_to("#{controller}#edit", project_id: 'gitlabhq', id: '1') if actions.include?(:edit) | |
41 | - end | |
42 | - | |
43 | - it "to #show" do | |
44 | - get("/gitlabhq/#{controller}/1").should route_to("#{controller}#show", project_id: 'gitlabhq', id: '1') if actions.include?(:show) | |
45 | - end | |
46 | - | |
47 | - it "to #update" do | |
48 | - put("/gitlabhq/#{controller}/1").should route_to("#{controller}#update", project_id: 'gitlabhq', id: '1') if actions.include?(:update) | |
49 | - end | |
50 | - | |
51 | - it "to #destroy" do | |
52 | - delete("/gitlabhq/#{controller}/1").should route_to("#{controller}#destroy", project_id: 'gitlabhq', id: '1') if actions.include?(:destroy) | |
53 | - end | |
54 | -end | |
55 | - | |
56 | 3 | # search GET /search(.:format) search#show |
57 | 4 | describe SearchController, "routing" do |
58 | 5 | it "to #show" do |
... | ... | @@ -225,53 +172,6 @@ describe DashboardController, "routing" do |
225 | 172 | end |
226 | 173 | end |
227 | 174 | |
228 | -# projects POST /projects(.:format) projects#create | |
229 | -# new_project GET /projects/new(.:format) projects#new | |
230 | -# wall_project GET /:id/wall(.:format) projects#wall | |
231 | -# graph_project GET /:id/graph(.:format) projects#graph | |
232 | -# files_project GET /:id/files(.:format) projects#files | |
233 | -# edit_project GET /:id/edit(.:format) projects#edit | |
234 | -# project GET /:id(.:format) projects#show | |
235 | -# PUT /:id(.:format) projects#update | |
236 | -# DELETE /:id(.:format) projects#destroy | |
237 | -describe ProjectsController, "routing" do | |
238 | - it "to #create" do | |
239 | - post("/projects").should route_to('projects#create') | |
240 | - end | |
241 | - | |
242 | - it "to #new" do | |
243 | - get("/projects/new").should route_to('projects#new') | |
244 | - end | |
245 | - | |
246 | - it "to #wall" do | |
247 | - get("/gitlabhq/wall").should route_to('projects#wall', id: 'gitlabhq') | |
248 | - end | |
249 | - | |
250 | - it "to #graph" do | |
251 | - get("/gitlabhq/graph").should route_to('projects#graph', id: 'gitlabhq') | |
252 | - end | |
253 | - | |
254 | - it "to #files" do | |
255 | - get("/gitlabhq/files").should route_to('projects#files', id: 'gitlabhq') | |
256 | - end | |
257 | - | |
258 | - it "to #edit" do | |
259 | - get("/gitlabhq/edit").should route_to('projects#edit', id: 'gitlabhq') | |
260 | - end | |
261 | - | |
262 | - it "to #show" do | |
263 | - get("/gitlabhq").should route_to('projects#show', id: 'gitlabhq') | |
264 | - end | |
265 | - | |
266 | - it "to #update" do | |
267 | - put("/gitlabhq").should route_to('projects#update', id: 'gitlabhq') | |
268 | - end | |
269 | - | |
270 | - it "to #destroy" do | |
271 | - delete("/gitlabhq").should route_to('projects#destroy', id: 'gitlabhq') | |
272 | - end | |
273 | -end | |
274 | - | |
275 | 175 | # new_user_session GET /users/sign_in(.:format) devise/sessions#new |
276 | 176 | # user_session POST /users/sign_in(.:format) devise/sessions#create |
277 | 177 | # destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy |
... | ... | @@ -284,300 +184,3 @@ end |
284 | 184 | describe "Authentication", "routing" do |
285 | 185 | # pending |
286 | 186 | end |
287 | - | |
288 | -# pages_project_wikis GET /:project_id/wikis/pages(.:format) wikis#pages | |
289 | -# history_project_wiki GET /:project_id/wikis/:id/history(.:format) wikis#history | |
290 | -# project_wikis POST /:project_id/wikis(.:format) wikis#create | |
291 | -# edit_project_wiki GET /:project_id/wikis/:id/edit(.:format) wikis#edit | |
292 | -# project_wiki GET /:project_id/wikis/:id(.:format) wikis#show | |
293 | -# DELETE /:project_id/wikis/:id(.:format) wikis#destroy | |
294 | -describe WikisController, "routing" do | |
295 | - it "to #pages" do | |
296 | - get("/gitlabhq/wikis/pages").should route_to('wikis#pages', project_id: 'gitlabhq') | |
297 | - end | |
298 | - | |
299 | - it "to #history" do | |
300 | - get("/gitlabhq/wikis/1/history").should route_to('wikis#history', project_id: 'gitlabhq', id: '1') | |
301 | - end | |
302 | - | |
303 | - it_behaves_like "RESTful project resources" do | |
304 | - let(:actions) { [:create, :edit, :show, :destroy] } | |
305 | - let(:controller) { 'wikis' } | |
306 | - end | |
307 | -end | |
308 | - | |
309 | -# branches_project_repository GET /:project_id/repository/branches(.:format) repositories#branches | |
310 | -# tags_project_repository GET /:project_id/repository/tags(.:format) repositories#tags | |
311 | -# archive_project_repository GET /:project_id/repository/archive(.:format) repositories#archive | |
312 | -# project_repository POST /:project_id/repository(.:format) repositories#create | |
313 | -# new_project_repository GET /:project_id/repository/new(.:format) repositories#new | |
314 | -# edit_project_repository GET /:project_id/repository/edit(.:format) repositories#edit | |
315 | -# GET /:project_id/repository(.:format) repositories#show | |
316 | -# PUT /:project_id/repository(.:format) repositories#update | |
317 | -# DELETE /:project_id/repository(.:format) repositories#destroy | |
318 | -describe RepositoriesController, "routing" do | |
319 | - it "to #branches" do | |
320 | - get("/gitlabhq/repository/branches").should route_to('repositories#branches', project_id: 'gitlabhq') | |
321 | - end | |
322 | - | |
323 | - it "to #tags" do | |
324 | - get("/gitlabhq/repository/tags").should route_to('repositories#tags', project_id: 'gitlabhq') | |
325 | - end | |
326 | - | |
327 | - it "to #archive" do | |
328 | - get("/gitlabhq/repository/archive").should route_to('repositories#archive', project_id: 'gitlabhq') | |
329 | - end | |
330 | - | |
331 | - it "to #create" do | |
332 | - post("/gitlabhq/repository").should route_to('repositories#create', project_id: 'gitlabhq') | |
333 | - end | |
334 | - | |
335 | - it "to #new" do | |
336 | - get("/gitlabhq/repository/new").should route_to('repositories#new', project_id: 'gitlabhq') | |
337 | - end | |
338 | - | |
339 | - it "to #edit" do | |
340 | - get("/gitlabhq/repository/edit").should route_to('repositories#edit', project_id: 'gitlabhq') | |
341 | - end | |
342 | - | |
343 | - it "to #show" do | |
344 | - get("/gitlabhq/repository").should route_to('repositories#show', project_id: 'gitlabhq') | |
345 | - end | |
346 | - | |
347 | - it "to #update" do | |
348 | - put("/gitlabhq/repository").should route_to('repositories#update', project_id: 'gitlabhq') | |
349 | - end | |
350 | - | |
351 | - it "to #destroy" do | |
352 | - delete("/gitlabhq/repository").should route_to('repositories#destroy', project_id: 'gitlabhq') | |
353 | - end | |
354 | -end | |
355 | - | |
356 | -# project_deploy_keys GET /:project_id/deploy_keys(.:format) deploy_keys#index | |
357 | -# POST /:project_id/deploy_keys(.:format) deploy_keys#create | |
358 | -# new_project_deploy_key GET /:project_id/deploy_keys/new(.:format) deploy_keys#new | |
359 | -# edit_project_deploy_key GET /:project_id/deploy_keys/:id/edit(.:format) deploy_keys#edit | |
360 | -# project_deploy_key GET /:project_id/deploy_keys/:id(.:format) deploy_keys#show | |
361 | -# PUT /:project_id/deploy_keys/:id(.:format) deploy_keys#update | |
362 | -# DELETE /:project_id/deploy_keys/:id(.:format) deploy_keys#destroy | |
363 | -describe DeployKeysController, "routing" do | |
364 | - it_behaves_like "RESTful project resources" do | |
365 | - let(:controller) { 'deploy_keys' } | |
366 | - end | |
367 | -end | |
368 | - | |
369 | -# project_protected_branches GET /:project_id/protected_branches(.:format) protected_branches#index | |
370 | -# POST /:project_id/protected_branches(.:format) protected_branches#create | |
371 | -# project_protected_branch DELETE /:project_id/protected_branches/:id(.:format) protected_branches#destroy | |
372 | -describe ProtectedBranchesController, "routing" do | |
373 | - it_behaves_like "RESTful project resources" do | |
374 | - let(:actions) { [:index, :create, :destroy] } | |
375 | - let(:controller) { 'protected_branches' } | |
376 | - end | |
377 | -end | |
378 | - | |
379 | -# switch_project_refs GET /:project_id/switch(.:format) refs#switch | |
380 | -# tree_project_ref GET /:project_id/:id/tree(.:format) refs#tree | |
381 | -# logs_tree_project_ref GET /:project_id/:id/logs_tree(.:format) refs#logs_tree | |
382 | -# blob_project_ref GET /:project_id/:id/blob(.:format) refs#blob | |
383 | -# tree_file_project_ref GET /:project_id/:id/tree/:path(.:format) refs#tree | |
384 | -# logs_file_project_ref GET /:project_id/:id/logs_tree/:path(.:format) refs#logs_tree | |
385 | -# blame_file_project_ref GET /:project_id/:id/blame/:path(.:format) refs#blame | |
386 | -describe RefsController, "routing" do | |
387 | - it "to #switch" do | |
388 | - get("/gitlabhq/switch").should route_to('refs#switch', project_id: 'gitlabhq') | |
389 | - end | |
390 | - | |
391 | - it "to #tree" do | |
392 | - get("/gitlabhq/stable/tree").should route_to('refs#tree', project_id: 'gitlabhq', id: 'stable') | |
393 | - get("/gitlabhq/stable/tree/foo/bar/baz").should route_to('refs#tree', project_id: 'gitlabhq', id: 'stable', path: 'foo/bar/baz') | |
394 | - end | |
395 | - | |
396 | - it "to #logs_tree" do | |
397 | - get("/gitlabhq/stable/logs_tree").should route_to('refs#logs_tree', project_id: 'gitlabhq', id: 'stable') | |
398 | - get("/gitlabhq/stable/logs_tree/foo/bar/baz").should route_to('refs#logs_tree', project_id: 'gitlabhq', id: 'stable', path: 'foo/bar/baz') | |
399 | - end | |
400 | - | |
401 | - it "to #blob" do | |
402 | - get("/gitlabhq/stable/blob").should route_to('refs#blob', project_id: 'gitlabhq', id: 'stable') | |
403 | - end | |
404 | - | |
405 | - it "to #blame" do | |
406 | - get("/gitlabhq/stable/blame/foo/bar/baz").should route_to('refs#blame', project_id: 'gitlabhq', id: 'stable', path: 'foo/bar/baz') | |
407 | - end | |
408 | -end | |
409 | - | |
410 | -# diffs_project_merge_request GET /:project_id/merge_requests/:id/diffs(.:format) merge_requests#diffs | |
411 | -# automerge_project_merge_request GET /:project_id/merge_requests/:id/automerge(.:format) merge_requests#automerge | |
412 | -# automerge_check_project_merge_request GET /:project_id/merge_requests/:id/automerge_check(.:format) merge_requests#automerge_check | |
413 | -# raw_project_merge_request GET /:project_id/merge_requests/:id/raw(.:format) merge_requests#raw | |
414 | -# branch_from_project_merge_requests GET /:project_id/merge_requests/branch_from(.:format) merge_requests#branch_from | |
415 | -# branch_to_project_merge_requests GET /:project_id/merge_requests/branch_to(.:format) merge_requests#branch_to | |
416 | -# project_merge_requests GET /:project_id/merge_requests(.:format) merge_requests#index | |
417 | -# POST /:project_id/merge_requests(.:format) merge_requests#create | |
418 | -# new_project_merge_request GET /:project_id/merge_requests/new(.:format) merge_requests#new | |
419 | -# edit_project_merge_request GET /:project_id/merge_requests/:id/edit(.:format) merge_requests#edit | |
420 | -# project_merge_request GET /:project_id/merge_requests/:id(.:format) merge_requests#show | |
421 | -# PUT /:project_id/merge_requests/:id(.:format) merge_requests#update | |
422 | -# DELETE /:project_id/merge_requests/:id(.:format) merge_requests#destroy | |
423 | -describe MergeRequestsController, "routing" do | |
424 | - it "to #diffs" do | |
425 | - get("/gitlabhq/merge_requests/1/diffs").should route_to('merge_requests#diffs', project_id: 'gitlabhq', id: '1') | |
426 | - end | |
427 | - | |
428 | - it "to #automerge" do | |
429 | - get("/gitlabhq/merge_requests/1/automerge").should route_to('merge_requests#automerge', project_id: 'gitlabhq', id: '1') | |
430 | - end | |
431 | - | |
432 | - it "to #automerge_check" do | |
433 | - get("/gitlabhq/merge_requests/1/automerge_check").should route_to('merge_requests#automerge_check', project_id: 'gitlabhq', id: '1') | |
434 | - end | |
435 | - | |
436 | - it "to #raw" do | |
437 | - get("/gitlabhq/merge_requests/1/raw").should route_to('merge_requests#raw', project_id: 'gitlabhq', id: '1') | |
438 | - end | |
439 | - | |
440 | - it "to #branch_from" do | |
441 | - get("/gitlabhq/merge_requests/branch_from").should route_to('merge_requests#branch_from', project_id: 'gitlabhq') | |
442 | - end | |
443 | - | |
444 | - it "to #branch_to" do | |
445 | - get("/gitlabhq/merge_requests/branch_to").should route_to('merge_requests#branch_to', project_id: 'gitlabhq') | |
446 | - end | |
447 | - | |
448 | - it_behaves_like "RESTful project resources" do | |
449 | - let(:controller) { 'merge_requests' } | |
450 | - end | |
451 | -end | |
452 | - | |
453 | -# raw_project_snippet GET /:project_id/snippets/:id/raw(.:format) snippets#raw | |
454 | -# project_snippets GET /:project_id/snippets(.:format) snippets#index | |
455 | -# POST /:project_id/snippets(.:format) snippets#create | |
456 | -# new_project_snippet GET /:project_id/snippets/new(.:format) snippets#new | |
457 | -# edit_project_snippet GET /:project_id/snippets/:id/edit(.:format) snippets#edit | |
458 | -# project_snippet GET /:project_id/snippets/:id(.:format) snippets#show | |
459 | -# PUT /:project_id/snippets/:id(.:format) snippets#update | |
460 | -# DELETE /:project_id/snippets/:id(.:format) snippets#destroy | |
461 | -describe SnippetsController, "routing" do | |
462 | - it "to #raw" do | |
463 | - get("/gitlabhq/snippets/1/raw").should route_to('snippets#raw', project_id: 'gitlabhq', id: '1') | |
464 | - end | |
465 | - | |
466 | - it_behaves_like "RESTful project resources" do | |
467 | - let(:controller) { 'snippets' } | |
468 | - end | |
469 | -end | |
470 | - | |
471 | -# test_project_hook GET /:project_id/hooks/:id/test(.:format) hooks#test | |
472 | -# project_hooks GET /:project_id/hooks(.:format) hooks#index | |
473 | -# POST /:project_id/hooks(.:format) hooks#create | |
474 | -# project_hook DELETE /:project_id/hooks/:id(.:format) hooks#destroy | |
475 | -describe HooksController, "routing" do | |
476 | - it "to #test" do | |
477 | - get("/gitlabhq/hooks/1/test").should route_to('hooks#test', project_id: 'gitlabhq', id: '1') | |
478 | - end | |
479 | - | |
480 | - it_behaves_like "RESTful project resources" do | |
481 | - let(:actions) { [:index, :create, :destroy] } | |
482 | - let(:controller) { 'hooks' } | |
483 | - end | |
484 | -end | |
485 | - | |
486 | -# compare_project_commits GET /:project_id/commits/compare(.:format) commits#compare | |
487 | -# patch_project_commit GET /:project_id/commits/:id/patch(.:format) commits#patch | |
488 | -# project_commits GET /:project_id/commits(.:format) commits#index | |
489 | -# POST /:project_id/commits(.:format) commits#create | |
490 | -# new_project_commit GET /:project_id/commits/new(.:format) commits#new | |
491 | -# edit_project_commit GET /:project_id/commits/:id/edit(.:format) commits#edit | |
492 | -# project_commit GET /:project_id/commits/:id(.:format) commits#show | |
493 | -# PUT /:project_id/commits/:id(.:format) commits#update | |
494 | -# DELETE /:project_id/commits/:id(.:format) commits#destroy | |
495 | -describe CommitsController, "routing" do | |
496 | - it "to #compare" do | |
497 | - get("/gitlabhq/commits/compare").should route_to('commits#compare', project_id: 'gitlabhq') | |
498 | - end | |
499 | - | |
500 | - it "to #patch" do | |
501 | - get("/gitlabhq/commits/1/patch").should route_to('commits#patch', project_id: 'gitlabhq', id: '1') | |
502 | - end | |
503 | - | |
504 | - it_behaves_like "RESTful project resources" do | |
505 | - let(:controller) { 'commits' } | |
506 | - end | |
507 | -end | |
508 | - | |
509 | -# project_team_members GET /:project_id/team_members(.:format) team_members#index | |
510 | -# POST /:project_id/team_members(.:format) team_members#create | |
511 | -# new_project_team_member GET /:project_id/team_members/new(.:format) team_members#new | |
512 | -# edit_project_team_member GET /:project_id/team_members/:id/edit(.:format) team_members#edit | |
513 | -# project_team_member GET /:project_id/team_members/:id(.:format) team_members#show | |
514 | -# PUT /:project_id/team_members/:id(.:format) team_members#update | |
515 | -# DELETE /:project_id/team_members/:id(.:format) team_members#destroy | |
516 | -describe TeamMembersController, "routing" do | |
517 | - it_behaves_like "RESTful project resources" do | |
518 | - let(:controller) { 'team_members' } | |
519 | - end | |
520 | -end | |
521 | - | |
522 | -# project_milestones GET /:project_id/milestones(.:format) milestones#index | |
523 | -# POST /:project_id/milestones(.:format) milestones#create | |
524 | -# new_project_milestone GET /:project_id/milestones/new(.:format) milestones#new | |
525 | -# edit_project_milestone GET /:project_id/milestones/:id/edit(.:format) milestones#edit | |
526 | -# project_milestone GET /:project_id/milestones/:id(.:format) milestones#show | |
527 | -# PUT /:project_id/milestones/:id(.:format) milestones#update | |
528 | -# DELETE /:project_id/milestones/:id(.:format) milestones#destroy | |
529 | -describe MilestonesController, "routing" do | |
530 | - it_behaves_like "RESTful project resources" do | |
531 | - let(:controller) { 'milestones' } | |
532 | - end | |
533 | -end | |
534 | - | |
535 | -# project_labels GET /:project_id/labels(.:format) labels#index | |
536 | -describe LabelsController, "routing" do | |
537 | - it "to #index" do | |
538 | - get("/gitlabhq/labels").should route_to('labels#index', project_id: 'gitlabhq') | |
539 | - end | |
540 | -end | |
541 | - | |
542 | -# sort_project_issues POST /:project_id/issues/sort(.:format) issues#sort | |
543 | -# bulk_update_project_issues POST /:project_id/issues/bulk_update(.:format) issues#bulk_update | |
544 | -# search_project_issues GET /:project_id/issues/search(.:format) issues#search | |
545 | -# project_issues GET /:project_id/issues(.:format) issues#index | |
546 | -# POST /:project_id/issues(.:format) issues#create | |
547 | -# new_project_issue GET /:project_id/issues/new(.:format) issues#new | |
548 | -# edit_project_issue GET /:project_id/issues/:id/edit(.:format) issues#edit | |
549 | -# project_issue GET /:project_id/issues/:id(.:format) issues#show | |
550 | -# PUT /:project_id/issues/:id(.:format) issues#update | |
551 | -# DELETE /:project_id/issues/:id(.:format) issues#destroy | |
552 | -describe IssuesController, "routing" do | |
553 | - it "to #sort" do | |
554 | - post("/gitlabhq/issues/sort").should route_to('issues#sort', project_id: 'gitlabhq') | |
555 | - end | |
556 | - | |
557 | - it "to #bulk_update" do | |
558 | - post("/gitlabhq/issues/bulk_update").should route_to('issues#bulk_update', project_id: 'gitlabhq') | |
559 | - end | |
560 | - | |
561 | - it "to #search" do | |
562 | - get("/gitlabhq/issues/search").should route_to('issues#search', project_id: 'gitlabhq') | |
563 | - end | |
564 | - | |
565 | - it_behaves_like "RESTful project resources" do | |
566 | - let(:controller) { 'issues' } | |
567 | - end | |
568 | -end | |
569 | - | |
570 | -# preview_project_notes POST /:project_id/notes/preview(.:format) notes#preview | |
571 | -# project_notes GET /:project_id/notes(.:format) notes#index | |
572 | -# POST /:project_id/notes(.:format) notes#create | |
573 | -# project_note DELETE /:project_id/notes/:id(.:format) notes#destroy | |
574 | -describe NotesController, "routing" do | |
575 | - it "to #preview" do | |
576 | - post("/gitlabhq/notes/preview").should route_to('notes#preview', project_id: 'gitlabhq') | |
577 | - end | |
578 | - | |
579 | - it_behaves_like "RESTful project resources" do | |
580 | - let(:actions) { [:index, :create, :destroy] } | |
581 | - let(:controller) { 'notes' } | |
582 | - end | |
583 | -end | ... | ... |