PageRenderTime 42ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/spec/routing/routing_spec.rb

https://gitlab.com/effigies/gitlab-ce
Ruby | 272 lines | 170 code | 46 blank | 56 comment | 0 complexity | bea9d3e57bda902ca9c664bdaf89a729 MD5 | raw file
  1. require 'spec_helper'
  2. # user GET /u/:username/
  3. # user_groups GET /u/:username/groups(.:format)
  4. # user_projects GET /u/:username/projects(.:format)
  5. # user_contributed_projects GET /u/:username/contributed(.:format)
  6. # user_snippets GET /u/:username/snippets(.:format)
  7. # user_calendar GET /u/:username/calendar(.:format)
  8. # user_calendar_activities GET /u/:username/calendar_activities(.:format)
  9. describe UsersController, "routing" do
  10. it "to #show" do
  11. expect(get("/u/User")).to route_to('users#show', username: 'User')
  12. end
  13. it "to #groups" do
  14. expect(get("/u/User/groups")).to route_to('users#groups', username: 'User')
  15. end
  16. it "to #projects" do
  17. expect(get("/u/User/projects")).to route_to('users#projects', username: 'User')
  18. end
  19. it "to #contributed" do
  20. expect(get("/u/User/contributed")).to route_to('users#contributed', username: 'User')
  21. end
  22. it "to #snippets" do
  23. expect(get("/u/User/snippets")).to route_to('users#snippets', username: 'User')
  24. end
  25. it "to #calendar" do
  26. expect(get("/u/User/calendar")).to route_to('users#calendar', username: 'User')
  27. end
  28. it "to #calendar_activities" do
  29. expect(get("/u/User/calendar_activities")).to route_to('users#calendar_activities', username: 'User')
  30. end
  31. end
  32. # search GET /search(.:format) search#show
  33. describe SearchController, "routing" do
  34. it "to #show" do
  35. expect(get("/search")).to route_to('search#show')
  36. end
  37. end
  38. # gitlab_api /api API::API
  39. # /:path Grack
  40. describe "Mounted Apps", "routing" do
  41. it "to API" do
  42. expect(get("/api/issues")).to be_routable
  43. end
  44. it "to Grack" do
  45. expect(get("/gitlab/gitlabhq.git")).to be_routable
  46. end
  47. end
  48. # snippets GET /snippets(.:format) snippets#index
  49. # POST /snippets(.:format) snippets#create
  50. # new_snippet GET /snippets/new(.:format) snippets#new
  51. # edit_snippet GET /snippets/:id/edit(.:format) snippets#edit
  52. # snippet GET /snippets/:id(.:format) snippets#show
  53. # PUT /snippets/:id(.:format) snippets#update
  54. # DELETE /snippets/:id(.:format) snippets#destroy
  55. describe SnippetsController, "routing" do
  56. it "to #raw" do
  57. expect(get("/snippets/1/raw")).to route_to('snippets#raw', id: '1')
  58. end
  59. it "to #index" do
  60. expect(get("/snippets")).to route_to('snippets#index')
  61. end
  62. it "to #create" do
  63. expect(post("/snippets")).to route_to('snippets#create')
  64. end
  65. it "to #new" do
  66. expect(get("/snippets/new")).to route_to('snippets#new')
  67. end
  68. it "to #edit" do
  69. expect(get("/snippets/1/edit")).to route_to('snippets#edit', id: '1')
  70. end
  71. it "to #show" do
  72. expect(get("/snippets/1")).to route_to('snippets#show', id: '1')
  73. end
  74. it "to #update" do
  75. expect(put("/snippets/1")).to route_to('snippets#update', id: '1')
  76. end
  77. it "to #destroy" do
  78. expect(delete("/snippets/1")).to route_to('snippets#destroy', id: '1')
  79. end
  80. end
  81. # help GET /help(.:format) help#index
  82. # help_page GET /help/*path(.:format) help#show
  83. # help_shortcuts GET /help/shortcuts(.:format) help#shortcuts
  84. # help_ui GET /help/ui(.:format) help#ui
  85. describe HelpController, "routing" do
  86. it "to #index" do
  87. expect(get("/help")).to route_to('help#index')
  88. end
  89. it 'to #show' do
  90. path = '/help/markdown/markdown.md'
  91. expect(get(path)).to route_to('help#show',
  92. path: 'markdown/markdown',
  93. format: 'md')
  94. path = '/help/workflow/protected_branches/protected_branches1.png'
  95. expect(get(path)).to route_to('help#show',
  96. path: 'workflow/protected_branches/protected_branches1',
  97. format: 'png')
  98. path = '/help/ui'
  99. expect(get(path)).to route_to('help#ui')
  100. end
  101. end
  102. # profile_account GET /profile/account(.:format) profile#account
  103. # profile_history GET /profile/history(.:format) profile#history
  104. # profile_password PUT /profile/password(.:format) profile#password_update
  105. # profile_token GET /profile/token(.:format) profile#token
  106. # profile_reset_private_token PUT /profile/reset_private_token(.:format) profile#reset_private_token
  107. # profile GET /profile(.:format) profile#show
  108. # profile_update PUT /profile/update(.:format) profile#update
  109. describe ProfilesController, "routing" do
  110. it "to #account" do
  111. expect(get("/profile/account")).to route_to('profiles/accounts#show')
  112. end
  113. it "to #audit_log" do
  114. expect(get("/profile/audit_log")).to route_to('profiles#audit_log')
  115. end
  116. it "to #reset_private_token" do
  117. expect(put("/profile/reset_private_token")).to route_to('profiles#reset_private_token')
  118. end
  119. it "to #show" do
  120. expect(get("/profile")).to route_to('profiles#show')
  121. end
  122. end
  123. # profile_preferences GET /profile/preferences(.:format) profiles/preferences#show
  124. # PATCH /profile/preferences(.:format) profiles/preferences#update
  125. # PUT /profile/preferences(.:format) profiles/preferences#update
  126. describe Profiles::PreferencesController, 'routing' do
  127. it 'to #show' do
  128. expect(get('/profile/preferences')).to route_to('profiles/preferences#show')
  129. end
  130. it 'to #update' do
  131. expect(put('/profile/preferences')).to route_to('profiles/preferences#update')
  132. expect(patch('/profile/preferences')).to route_to('profiles/preferences#update')
  133. end
  134. end
  135. # keys GET /keys(.:format) keys#index
  136. # POST /keys(.:format) keys#create
  137. # edit_key GET /keys/:id/edit(.:format) keys#edit
  138. # key GET /keys/:id(.:format) keys#show
  139. # PUT /keys/:id(.:format) keys#update
  140. # DELETE /keys/:id(.:format) keys#destroy
  141. describe Profiles::KeysController, "routing" do
  142. it "to #index" do
  143. expect(get("/profile/keys")).to route_to('profiles/keys#index')
  144. end
  145. it "to #create" do
  146. expect(post("/profile/keys")).to route_to('profiles/keys#create')
  147. end
  148. it "to #show" do
  149. expect(get("/profile/keys/1")).to route_to('profiles/keys#show', id: '1')
  150. end
  151. it "to #destroy" do
  152. expect(delete("/profile/keys/1")).to route_to('profiles/keys#destroy', id: '1')
  153. end
  154. # get all the ssh-keys of a user
  155. it "to #get_keys" do
  156. expect(get("/foo.keys")).to route_to('profiles/keys#get_keys', username: 'foo')
  157. end
  158. end
  159. # emails GET /emails(.:format) emails#index
  160. # POST /keys(.:format) emails#create
  161. # DELETE /keys/:id(.:format) keys#destroy
  162. describe Profiles::EmailsController, "routing" do
  163. it "to #index" do
  164. expect(get("/profile/emails")).to route_to('profiles/emails#index')
  165. end
  166. it "to #create" do
  167. expect(post("/profile/emails")).to route_to('profiles/emails#create')
  168. end
  169. it "to #destroy" do
  170. expect(delete("/profile/emails/1")).to route_to('profiles/emails#destroy', id: '1')
  171. end
  172. end
  173. # profile_avatar DELETE /profile/avatar(.:format) profiles/avatars#destroy
  174. describe Profiles::AvatarsController, "routing" do
  175. it "to #destroy" do
  176. expect(delete("/profile/avatar")).to route_to('profiles/avatars#destroy')
  177. end
  178. end
  179. # dashboard GET /dashboard(.:format) dashboard#show
  180. # dashboard_issues GET /dashboard/issues(.:format) dashboard#issues
  181. # dashboard_merge_requests GET /dashboard/merge_requests(.:format) dashboard#merge_requests
  182. describe DashboardController, "routing" do
  183. it "to #index" do
  184. expect(get("/dashboard")).to route_to('dashboard/projects#index')
  185. end
  186. it "to #issues" do
  187. expect(get("/dashboard/issues")).to route_to('dashboard#issues')
  188. end
  189. it "to #merge_requests" do
  190. expect(get("/dashboard/merge_requests")).to route_to('dashboard#merge_requests')
  191. end
  192. end
  193. # root / root#show
  194. describe RootController, 'routing' do
  195. it 'to #index' do
  196. expect(get('/')).to route_to('root#index')
  197. end
  198. end
  199. # new_user_session GET /users/sign_in(.:format) devise/sessions#new
  200. # user_session POST /users/sign_in(.:format) devise/sessions#create
  201. # destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy
  202. # user_omniauth_authorize /users/auth/:provider(.:format) omniauth_callbacks#passthru
  203. # user_omniauth_callback /users/auth/:action/callback(.:format) omniauth_callbacks#(?-mix:(?!))
  204. # user_password POST /users/password(.:format) devise/passwords#create
  205. # new_user_password GET /users/password/new(.:format) devise/passwords#new
  206. # edit_user_password GET /users/password/edit(.:format) devise/passwords#edit
  207. # PUT /users/password(.:format) devise/passwords#update
  208. describe "Authentication", "routing" do
  209. # pending
  210. end
  211. describe "Groups", "routing" do
  212. it "to #show" do
  213. expect(get("/groups/1")).to route_to('groups#show', id: '1')
  214. end
  215. it "also display group#show on the short path" do
  216. expect(get('/1')).to route_to('namespaces#show', id: '1')
  217. end
  218. end
  219. describe HealthCheckController, 'routing' do
  220. it 'to #index' do
  221. expect(get('/health_check')).to route_to('health_check#index')
  222. end
  223. it 'also supports passing checks in the url' do
  224. expect(get('/health_check/email')).to route_to('health_check#index', checks: 'email')
  225. end
  226. end