BigW Consortium Gitlab

routing_spec.rb 8.46 KB
Newer Older
Robert Speicher committed
1 2 3 4 5
require 'spec_helper'

# search GET    /search(.:format) search#show
describe SearchController, "routing" do
  it "to #show" do
6
    expect(get("/search")).to route_to('search#show')
Robert Speicher committed
7 8 9
  end
end

10
# gitlab_api /api         API::API
Robert Speicher committed
11 12 13
#            /:path       Grack
describe "Mounted Apps", "routing" do
  it "to API" do
14
    expect(get("/api/issues")).to be_routable
Robert Speicher committed
15 16 17
  end

  it "to Grack" do
18
    expect(get("/gitlab/gitlabhq.git")).to be_routable
Robert Speicher committed
19 20 21
  end
end

22 23 24 25 26 27 28 29 30
#     snippets GET    /snippets(.:format)          snippets#index
#          POST   /snippets(.:format)          snippets#create
#  new_snippet GET    /snippets/new(.:format)      snippets#new
# edit_snippet GET    /snippets/:id/edit(.:format) snippets#edit
#      snippet GET    /snippets/:id(.:format)      snippets#show
#          PUT    /snippets/:id(.:format)      snippets#update
#          DELETE /snippets/:id(.:format)      snippets#destroy
describe SnippetsController, "routing" do
  it "to #user_index" do
Dmitriy Zaporozhets committed
31
    expect(get("/s/User")).to route_to('snippets#index', username: 'User')
32 33 34
  end

  it "to #raw" do
35
    expect(get("/snippets/1/raw")).to route_to('snippets#raw', id: '1')
36 37 38
  end

  it "to #index" do
39
    expect(get("/snippets")).to route_to('snippets#index')
40 41 42
  end

  it "to #create" do
43
    expect(post("/snippets")).to route_to('snippets#create')
44 45 46
  end

  it "to #new" do
47
    expect(get("/snippets/new")).to route_to('snippets#new')
48 49 50
  end

  it "to #edit" do
51
    expect(get("/snippets/1/edit")).to route_to('snippets#edit', id: '1')
52 53 54
  end

  it "to #show" do
55
    expect(get("/snippets/1")).to route_to('snippets#show', id: '1')
56 57 58
  end

  it "to #update" do
59
    expect(put("/snippets/1")).to route_to('snippets#update', id: '1')
60 61 62
  end

  it "to #destroy" do
63
    expect(delete("/snippets/1")).to route_to('snippets#destroy', id: '1')
64 65 66
  end
end

67
#            help GET /help(.:format)                 help#index
68
#       help_page GET /help/:category/:file(.:format) help#show {:category=>/.*/, :file=>/[^\/\.]+/}
69 70
#  help_shortcuts GET /help/shortcuts(.:format)       help#shortcuts
#         help_ui GET /help/ui(.:format)              help#ui
71 72 73
describe HelpController, "routing" do
  it "to #index" do
    expect(get("/help")).to route_to('help#index')
Robert Speicher committed
74 75
  end

76 77 78 79 80 81
  it 'to #show' do
    path = '/help/markdown/markdown.md'
    expect(get(path)).to route_to('help#show',
                                  category: 'markdown',
                                  file: 'markdown',
                                  format: 'md')
Robert Speicher committed
82

83 84 85 86 87
    path = '/help/workflow/protected_branches/protected_branches1.png'
    expect(get(path)).to route_to('help#show',
                                  category: 'workflow/protected_branches',
                                  file: 'protected_branches1',
                                  format: 'png')
Robert Speicher committed
88 89
  end

90 91
  it 'to #shortcuts' do
    expect(get('/help/shortcuts')).to route_to('help#shortcuts')
Robert Speicher committed
92
  end
93

94 95
  it 'to #ui' do
    expect(get('/help/ui')).to route_to('help#ui')
96
  end
Robert Speicher committed
97 98 99 100 101 102 103 104 105
end

#             profile_account GET    /profile/account(.:format)             profile#account
#             profile_history GET    /profile/history(.:format)             profile#history
#            profile_password PUT    /profile/password(.:format)            profile#password_update
#               profile_token GET    /profile/token(.:format)               profile#token
# profile_reset_private_token PUT    /profile/reset_private_token(.:format) profile#reset_private_token
#                     profile GET    /profile(.:format)                     profile#show
#              profile_update PUT    /profile/update(.:format)              profile#update
106
describe ProfilesController, "routing" do
Robert Speicher committed
107
  it "to #account" do
108
    expect(get("/profile/account")).to route_to('profiles/accounts#show')
Robert Speicher committed
109 110
  end

111 112
  it "to #audit_log" do
    expect(get("/profile/audit_log")).to route_to('profiles#audit_log')
Robert Speicher committed
113 114 115
  end

  it "to #reset_private_token" do
116
    expect(put("/profile/reset_private_token")).to route_to('profiles#reset_private_token')
Robert Speicher committed
117 118 119
  end

  it "to #show" do
120
    expect(get("/profile")).to route_to('profiles#show')
Robert Speicher committed
121
  end
122 123 124 125 126 127 128 129 130
end

# profile_preferences GET      /profile/preferences(.:format) profiles/preferences#show
#                     PATCH    /profile/preferences(.:format) profiles/preferences#update
#                     PUT      /profile/preferences(.:format) profiles/preferences#update
describe Profiles::PreferencesController, 'routing' do
  it 'to #show' do
    expect(get('/profile/preferences')).to route_to('profiles/preferences#show')
  end
Robert Speicher committed
131

132 133 134
  it 'to #update' do
    expect(put('/profile/preferences')).to   route_to('profiles/preferences#update')
    expect(patch('/profile/preferences')).to route_to('profiles/preferences#update')
Robert Speicher committed
135 136 137 138 139 140 141 142 143
  end
end

#     keys GET    /keys(.:format)          keys#index
#          POST   /keys(.:format)          keys#create
# edit_key GET    /keys/:id/edit(.:format) keys#edit
#      key GET    /keys/:id(.:format)      keys#show
#          PUT    /keys/:id(.:format)      keys#update
#          DELETE /keys/:id(.:format)      keys#destroy
144
describe Profiles::KeysController, "routing" do
Robert Speicher committed
145
  it "to #index" do
146
    expect(get("/profile/keys")).to route_to('profiles/keys#index')
Robert Speicher committed
147 148 149
  end

  it "to #create" do
150
    expect(post("/profile/keys")).to route_to('profiles/keys#create')
Robert Speicher committed
151 152 153
  end

  it "to #edit" do
154
    expect(get("/profile/keys/1/edit")).to route_to('profiles/keys#edit', id: '1')
Robert Speicher committed
155 156 157
  end

  it "to #show" do
158
    expect(get("/profile/keys/1")).to route_to('profiles/keys#show', id: '1')
Robert Speicher committed
159 160 161
  end

  it "to #update" do
162
    expect(put("/profile/keys/1")).to route_to('profiles/keys#update', id: '1')
Robert Speicher committed
163 164 165
  end

  it "to #destroy" do
166
    expect(delete("/profile/keys/1")).to route_to('profiles/keys#destroy', id: '1')
Robert Speicher committed
167
  end
168 169 170

  # get all the ssh-keys of a user
  it "to #get_keys" do
171
    expect(get("/foo.keys")).to route_to('profiles/keys#get_keys', username: 'foo')
172
  end
Robert Speicher committed
173 174
end

175 176 177 178 179
#   emails GET    /emails(.:format)        emails#index
#          POST   /keys(.:format)          emails#create
#          DELETE /keys/:id(.:format)      keys#destroy
describe Profiles::EmailsController, "routing" do
  it "to #index" do
180
    expect(get("/profile/emails")).to route_to('profiles/emails#index')
181 182 183
  end

  it "to #create" do
184
    expect(post("/profile/emails")).to route_to('profiles/emails#create')
185 186 187
  end

  it "to #destroy" do
188
    expect(delete("/profile/emails/1")).to route_to('profiles/emails#destroy', id: '1')
189 190 191
  end
end

192 193 194
# profile_avatar DELETE /profile/avatar(.:format) profiles/avatars#destroy
describe Profiles::AvatarsController, "routing" do
  it "to #destroy" do
195
    expect(delete("/profile/avatar")).to route_to('profiles/avatars#destroy')
196 197 198
  end
end

199
#                dashboard GET    /dashboard(.:format)                dashboard#show
Robert Speicher committed
200 201 202 203
#         dashboard_issues GET    /dashboard/issues(.:format)         dashboard#issues
# dashboard_merge_requests GET    /dashboard/merge_requests(.:format) dashboard#merge_requests
describe DashboardController, "routing" do
  it "to #index" do
204
    expect(get("/dashboard")).to route_to('dashboard/projects#index')
Robert Speicher committed
205 206 207
  end

  it "to #issues" do
208
    expect(get("/dashboard/issues")).to route_to('dashboard#issues')
Robert Speicher committed
209 210 211
  end

  it "to #merge_requests" do
212
    expect(get("/dashboard/merge_requests")).to route_to('dashboard#merge_requests')
Robert Speicher committed
213 214 215
  end
end

Robert Speicher committed
216 217
#                     root        /                                   root#show
describe RootController, 'routing' do
218 219
  it 'to #index' do
    expect(get('/')).to route_to('root#index')
Robert Speicher committed
220 221 222 223
  end
end


Robert Speicher committed
224 225 226 227 228 229 230 231 232 233 234 235
#        new_user_session GET    /users/sign_in(.:format)               devise/sessions#new
#            user_session POST   /users/sign_in(.:format)               devise/sessions#create
#    destroy_user_session DELETE /users/sign_out(.:format)              devise/sessions#destroy
# user_omniauth_authorize        /users/auth/:provider(.:format)        omniauth_callbacks#passthru
#  user_omniauth_callback        /users/auth/:action/callback(.:format) omniauth_callbacks#(?-mix:(?!))
#           user_password POST   /users/password(.:format)              devise/passwords#create
#       new_user_password GET    /users/password/new(.:format)          devise/passwords#new
#      edit_user_password GET    /users/password/edit(.:format)         devise/passwords#edit
#                         PUT    /users/password(.:format)              devise/passwords#update
describe "Authentication", "routing" do
  # pending
end
236 237 238

describe "Groups", "routing" do
  it "to #show" do
239
    expect(get("/groups/1")).to route_to('groups#show', id: '1')
240 241
  end

242
  it "also display group#show on the short path" do
243
    expect(get('/1')).to route_to('namespaces#show', id: '1')
244 245
  end
end