Commit 718ec26a23e3e303e04c569447acf963b9ef307e
1 parent
9e2525cb
Exists in
master
and in
4 other branches
Routing updated to support global snippets
Showing
2 changed files
with
53 additions
and
0 deletions
Show diff stats
config/routes.rb
... | ... | @@ -100,6 +100,14 @@ Gitlab::Application.routes.draw do |
100 | 100 | |
101 | 101 | get "errors/githost" |
102 | 102 | |
103 | + resources :snippets do | |
104 | + member do | |
105 | + get "raw" | |
106 | + get "my" | |
107 | + end | |
108 | + end | |
109 | + match "/s/:username" => "snippets#user_index", as: :user_snippets, constraints: { username: /.*/ } | |
110 | + | |
103 | 111 | # |
104 | 112 | # Profile Area |
105 | 113 | # | ... | ... |
spec/routing/routing_spec.rb
... | ... | @@ -25,6 +25,51 @@ describe "Mounted Apps", "routing" do |
25 | 25 | end |
26 | 26 | end |
27 | 27 | |
28 | +# snippets GET /snippets(.:format) snippets#index | |
29 | +# POST /snippets(.:format) snippets#create | |
30 | +# new_snippet GET /snippets/new(.:format) snippets#new | |
31 | +# edit_snippet GET /snippets/:id/edit(.:format) snippets#edit | |
32 | +# snippet GET /snippets/:id(.:format) snippets#show | |
33 | +# PUT /snippets/:id(.:format) snippets#update | |
34 | +# DELETE /snippets/:id(.:format) snippets#destroy | |
35 | +describe SnippetsController, "routing" do | |
36 | + it "to #user_index" do | |
37 | + get("/s/User").should route_to('snippets#user_index', username: 'User') | |
38 | + end | |
39 | + | |
40 | + it "to #raw" do | |
41 | + get("/snippets/1/raw").should route_to('snippets#raw', id: '1') | |
42 | + end | |
43 | + | |
44 | + it "to #index" do | |
45 | + get("/snippets").should route_to('snippets#index') | |
46 | + end | |
47 | + | |
48 | + it "to #create" do | |
49 | + post("/snippets").should route_to('snippets#create') | |
50 | + end | |
51 | + | |
52 | + it "to #new" do | |
53 | + get("/snippets/new").should route_to('snippets#new') | |
54 | + end | |
55 | + | |
56 | + it "to #edit" do | |
57 | + get("/snippets/1/edit").should route_to('snippets#edit', id: '1') | |
58 | + end | |
59 | + | |
60 | + it "to #show" do | |
61 | + get("/snippets/1").should route_to('snippets#show', id: '1') | |
62 | + end | |
63 | + | |
64 | + it "to #update" do | |
65 | + put("/snippets/1").should route_to('snippets#update', id: '1') | |
66 | + end | |
67 | + | |
68 | + it "to #destroy" do | |
69 | + delete("/snippets/1").should route_to('snippets#destroy', id: '1') | |
70 | + end | |
71 | +end | |
72 | + | |
28 | 73 | # help GET /help(.:format) help#index |
29 | 74 | # help_permissions GET /help/permissions(.:format) help#permissions |
30 | 75 | # help_workflow GET /help/workflow(.:format) help#workflow | ... | ... |