2012-09-16 08:21:46 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2016-05-08 15:06:19 +00:00
|
|
|
# user GET /u/:username/
|
|
|
|
# user_groups GET /u/:username/groups(.:format)
|
|
|
|
# user_projects GET /u/:username/projects(.:format)
|
|
|
|
# user_contributed_projects GET /u/:username/contributed(.:format)
|
|
|
|
# user_snippets GET /u/:username/snippets(.:format)
|
|
|
|
# user_calendar GET /u/:username/calendar(.:format)
|
|
|
|
# user_calendar_activities GET /u/:username/calendar_activities(.:format)
|
|
|
|
describe UsersController, "routing" do
|
|
|
|
it "to #show" do
|
2016-11-14 14:55:31 +00:00
|
|
|
allow_any_instance_of(UserUrlConstrainer).to receive(:matches?).and_return(true)
|
2016-10-06 12:14:24 +00:00
|
|
|
|
|
|
|
expect(get("/User")).to route_to('users#show', username: 'User')
|
2016-05-08 15:06:19 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "to #groups" do
|
2016-10-13 11:11:26 +00:00
|
|
|
expect(get("/users/User/groups")).to route_to('users#groups', username: 'User')
|
2016-05-08 15:06:19 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "to #projects" do
|
2016-10-13 11:11:26 +00:00
|
|
|
expect(get("/users/User/projects")).to route_to('users#projects', username: 'User')
|
2016-05-08 15:06:19 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "to #contributed" do
|
2016-10-13 11:11:26 +00:00
|
|
|
expect(get("/users/User/contributed")).to route_to('users#contributed', username: 'User')
|
2016-05-08 15:06:19 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "to #snippets" do
|
2016-10-13 11:11:26 +00:00
|
|
|
expect(get("/users/User/snippets")).to route_to('users#snippets', username: 'User')
|
2016-05-08 15:06:19 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "to #calendar" do
|
2016-10-13 11:11:26 +00:00
|
|
|
expect(get("/users/User/calendar")).to route_to('users#calendar', username: 'User')
|
2016-05-08 15:06:19 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "to #calendar_activities" do
|
2016-10-13 11:11:26 +00:00
|
|
|
expect(get("/users/User/calendar_activities")).to route_to('users#calendar_activities', username: 'User')
|
2016-05-08 15:06:19 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-09-16 08:21:46 +00:00
|
|
|
# search GET /search(.:format) search#show
|
|
|
|
describe SearchController, "routing" do
|
|
|
|
it "to #show" do
|
2015-02-12 18:17:35 +00:00
|
|
|
expect(get("/search")).to route_to('search#show')
|
2012-09-16 08:21:46 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-05-14 12:33:31 +00:00
|
|
|
# gitlab_api /api API::API
|
2012-09-16 08:21:46 +00:00
|
|
|
# /:path Grack
|
|
|
|
describe "Mounted Apps", "routing" do
|
|
|
|
it "to API" do
|
2015-02-12 18:17:35 +00:00
|
|
|
expect(get("/api/issues")).to be_routable
|
2012-09-16 08:21:46 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "to Grack" do
|
2015-02-12 18:17:35 +00:00
|
|
|
expect(get("/gitlab/gitlabhq.git")).to be_routable
|
2012-09-16 08:21:46 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-03-24 19:55:51 +00:00
|
|
|
# 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 #raw" do
|
2015-02-12 18:17:35 +00:00
|
|
|
expect(get("/snippets/1/raw")).to route_to('snippets#raw', id: '1')
|
2013-03-24 19:55:51 +00:00
|
|
|
end
|
|
|
|
|
2016-05-08 08:27:33 +00:00
|
|
|
it "to #index" do
|
|
|
|
expect(get("/snippets")).to route_to('snippets#index')
|
|
|
|
end
|
|
|
|
|
2013-03-24 19:55:51 +00:00
|
|
|
it "to #create" do
|
2015-02-12 18:17:35 +00:00
|
|
|
expect(post("/snippets")).to route_to('snippets#create')
|
2013-03-24 19:55:51 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "to #new" do
|
2015-02-12 18:17:35 +00:00
|
|
|
expect(get("/snippets/new")).to route_to('snippets#new')
|
2013-03-24 19:55:51 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "to #edit" do
|
2015-02-12 18:17:35 +00:00
|
|
|
expect(get("/snippets/1/edit")).to route_to('snippets#edit', id: '1')
|
2013-03-24 19:55:51 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "to #show" do
|
2015-02-12 18:17:35 +00:00
|
|
|
expect(get("/snippets/1")).to route_to('snippets#show', id: '1')
|
2013-03-24 19:55:51 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "to #update" do
|
2015-02-12 18:17:35 +00:00
|
|
|
expect(put("/snippets/1")).to route_to('snippets#update', id: '1')
|
2013-03-24 19:55:51 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "to #destroy" do
|
2015-02-12 18:17:35 +00:00
|
|
|
expect(delete("/snippets/1")).to route_to('snippets#destroy', id: '1')
|
2013-03-24 19:55:51 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-04-11 20:49:03 +00:00
|
|
|
# help GET /help(.:format) help#index
|
2016-07-11 22:11:33 +00:00
|
|
|
# help_page GET /help/*path(.:format) help#show
|
2015-04-11 20:49:03 +00:00
|
|
|
# help_shortcuts GET /help/shortcuts(.:format) help#shortcuts
|
|
|
|
# help_ui GET /help/ui(.:format) help#ui
|
2015-04-15 16:24:44 +00:00
|
|
|
describe HelpController, "routing" do
|
|
|
|
it "to #index" do
|
|
|
|
expect(get("/help")).to route_to('help#index')
|
2012-09-16 08:21:46 +00:00
|
|
|
end
|
|
|
|
|
2015-04-11 20:49:03 +00:00
|
|
|
it 'to #show' do
|
2016-08-25 14:19:14 +00:00
|
|
|
path = '/help/user/markdown.md'
|
2015-04-11 20:49:03 +00:00
|
|
|
expect(get(path)).to route_to('help#show',
|
2016-08-25 14:19:14 +00:00
|
|
|
path: 'user/markdown',
|
2015-04-11 20:49:03 +00:00
|
|
|
format: 'md')
|
2012-09-16 08:21:46 +00:00
|
|
|
|
2015-04-11 20:49:03 +00:00
|
|
|
path = '/help/workflow/protected_branches/protected_branches1.png'
|
|
|
|
expect(get(path)).to route_to('help#show',
|
2016-07-11 22:11:33 +00:00
|
|
|
path: 'workflow/protected_branches/protected_branches1',
|
2015-04-11 20:49:03 +00:00
|
|
|
format: 'png')
|
2016-07-26 03:59:39 +00:00
|
|
|
|
2016-07-11 22:11:33 +00:00
|
|
|
path = '/help/ui'
|
2016-07-19 17:17:14 +00:00
|
|
|
expect(get(path)).to route_to('help#ui')
|
2012-12-08 10:42:38 +00:00
|
|
|
end
|
2012-09-16 08:21:46 +00:00
|
|
|
end
|
|
|
|
|
2016-07-26 03:59:39 +00:00
|
|
|
# koding GET /koding(.:format) koding#index
|
|
|
|
describe KodingController, "routing" do
|
|
|
|
it "to #index" do
|
|
|
|
expect(get("/koding")).to route_to('koding#index')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-09-16 08:21:46 +00:00
|
|
|
# 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 GET /profile(.:format) profile#show
|
|
|
|
# profile_update PUT /profile/update(.:format) profile#update
|
2012-12-02 11:29:24 +00:00
|
|
|
describe ProfilesController, "routing" do
|
2012-09-16 08:21:46 +00:00
|
|
|
it "to #account" do
|
2015-02-12 18:17:35 +00:00
|
|
|
expect(get("/profile/account")).to route_to('profiles/accounts#show')
|
2012-09-16 08:21:46 +00:00
|
|
|
end
|
|
|
|
|
2015-07-03 11:54:50 +00:00
|
|
|
it "to #audit_log" do
|
|
|
|
expect(get("/profile/audit_log")).to route_to('profiles#audit_log')
|
2012-09-16 08:21:46 +00:00
|
|
|
end
|
|
|
|
|
2017-05-23 15:02:05 +00:00
|
|
|
it "to #reset_rss_token" do
|
|
|
|
expect(put("/profile/reset_rss_token")).to route_to('profiles#reset_rss_token')
|
|
|
|
end
|
|
|
|
|
2012-09-16 08:21:46 +00:00
|
|
|
it "to #show" do
|
2015-02-12 18:17:35 +00:00
|
|
|
expect(get("/profile")).to route_to('profiles#show')
|
2012-09-16 08:21:46 +00:00
|
|
|
end
|
2015-06-05 18:00:21 +00:00
|
|
|
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
|
2012-09-16 08:21:46 +00:00
|
|
|
|
2015-06-05 18:00:21 +00:00
|
|
|
it 'to #update' do
|
|
|
|
expect(put('/profile/preferences')).to route_to('profiles/preferences#update')
|
|
|
|
expect(patch('/profile/preferences')).to route_to('profiles/preferences#update')
|
2012-09-16 08:21:46 +00:00
|
|
|
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
|
2013-06-24 15:24:14 +00:00
|
|
|
describe Profiles::KeysController, "routing" do
|
2012-09-16 08:21:46 +00:00
|
|
|
it "to #index" do
|
2015-02-12 18:17:35 +00:00
|
|
|
expect(get("/profile/keys")).to route_to('profiles/keys#index')
|
2012-09-16 08:21:46 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "to #create" do
|
2015-02-12 18:17:35 +00:00
|
|
|
expect(post("/profile/keys")).to route_to('profiles/keys#create')
|
2012-09-16 08:21:46 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "to #show" do
|
2015-02-12 18:17:35 +00:00
|
|
|
expect(get("/profile/keys/1")).to route_to('profiles/keys#show', id: '1')
|
2012-09-16 08:21:46 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "to #destroy" do
|
2015-02-12 18:17:35 +00:00
|
|
|
expect(delete("/profile/keys/1")).to route_to('profiles/keys#destroy', id: '1')
|
2012-09-16 08:21:46 +00:00
|
|
|
end
|
2014-02-06 09:12:59 +00:00
|
|
|
|
|
|
|
# get all the ssh-keys of a user
|
|
|
|
it "to #get_keys" do
|
2016-11-14 14:55:31 +00:00
|
|
|
allow_any_instance_of(UserUrlConstrainer).to receive(:matches?).and_return(true)
|
|
|
|
|
2015-02-12 18:17:35 +00:00
|
|
|
expect(get("/foo.keys")).to route_to('profiles/keys#get_keys', username: 'foo')
|
2014-02-06 09:12:59 +00:00
|
|
|
end
|
2012-09-16 08:21:46 +00:00
|
|
|
end
|
|
|
|
|
2014-02-09 03:08:49 +00:00
|
|
|
# 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
|
2015-02-12 18:17:35 +00:00
|
|
|
expect(get("/profile/emails")).to route_to('profiles/emails#index')
|
2014-02-09 03:08:49 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "to #create" do
|
2015-02-12 18:17:35 +00:00
|
|
|
expect(post("/profile/emails")).to route_to('profiles/emails#create')
|
2014-02-09 03:08:49 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "to #destroy" do
|
2015-02-12 18:17:35 +00:00
|
|
|
expect(delete("/profile/emails/1")).to route_to('profiles/emails#destroy', id: '1')
|
2014-02-09 03:08:49 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-12-02 18:03:07 +00:00
|
|
|
# profile_avatar DELETE /profile/avatar(.:format) profiles/avatars#destroy
|
|
|
|
describe Profiles::AvatarsController, "routing" do
|
|
|
|
it "to #destroy" do
|
2015-02-12 18:17:35 +00:00
|
|
|
expect(delete("/profile/avatar")).to route_to('profiles/avatars#destroy')
|
2013-12-02 18:03:07 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-01-27 11:20:23 +00:00
|
|
|
# dashboard GET /dashboard(.:format) dashboard#show
|
2012-09-16 08:21:46 +00:00
|
|
|
# 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
|
2015-09-08 14:14:14 +00:00
|
|
|
expect(get("/dashboard")).to route_to('dashboard/projects#index')
|
2012-09-16 08:21:46 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "to #issues" do
|
2015-02-12 18:17:35 +00:00
|
|
|
expect(get("/dashboard/issues")).to route_to('dashboard#issues')
|
2012-09-16 08:21:46 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "to #merge_requests" do
|
2015-02-12 18:17:35 +00:00
|
|
|
expect(get("/dashboard/merge_requests")).to route_to('dashboard#merge_requests')
|
2012-09-16 08:21:46 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-06-10 07:59:39 +00:00
|
|
|
# root / root#show
|
|
|
|
describe RootController, 'routing' do
|
2015-09-08 14:14:14 +00:00
|
|
|
it 'to #index' do
|
|
|
|
expect(get('/')).to route_to('root#index')
|
2015-06-10 07:59:39 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-09-16 08:21:46 +00:00
|
|
|
describe "Authentication", "routing" do
|
2017-05-18 16:25:50 +00:00
|
|
|
it "GET /users/sign_in" do
|
|
|
|
expect(get("/users/sign_in")).to route_to('sessions#new')
|
|
|
|
end
|
|
|
|
|
|
|
|
it "POST /users/sign_in" do
|
|
|
|
expect(post("/users/sign_in")).to route_to('sessions#create')
|
|
|
|
end
|
|
|
|
|
|
|
|
it "DELETE /users/sign_out" do
|
|
|
|
expect(delete("/users/sign_out")).to route_to('sessions#destroy')
|
|
|
|
end
|
|
|
|
|
|
|
|
it "POST /users/password" do
|
|
|
|
expect(post("/users/password")).to route_to('passwords#create')
|
|
|
|
end
|
|
|
|
|
|
|
|
it "GET /users/password/new" do
|
|
|
|
expect(get("/users/password/new")).to route_to('passwords#new')
|
|
|
|
end
|
|
|
|
|
|
|
|
it "GET /users/password/edit" do
|
|
|
|
expect(get("/users/password/edit")).to route_to('passwords#edit')
|
|
|
|
end
|
|
|
|
|
|
|
|
it "PUT /users/password" do
|
|
|
|
expect(put("/users/password")).to route_to('passwords#update')
|
|
|
|
end
|
2012-09-16 08:21:46 +00:00
|
|
|
end
|
2014-04-13 15:46:41 +00:00
|
|
|
|
|
|
|
describe "Groups", "routing" do
|
2016-11-21 19:03:18 +00:00
|
|
|
let(:name) { 'complex.group-namegit' }
|
2017-10-20 13:39:01 +00:00
|
|
|
let!(:group) { create(:group, name: name) }
|
2016-11-14 14:55:31 +00:00
|
|
|
|
2014-04-13 15:46:41 +00:00
|
|
|
it "to #show" do
|
2016-11-21 10:41:44 +00:00
|
|
|
expect(get("/groups/#{name}")).to route_to('groups#show', id: name)
|
2014-04-13 15:46:41 +00:00
|
|
|
end
|
|
|
|
|
2016-11-14 14:55:31 +00:00
|
|
|
it "also supports nested groups" do
|
2017-10-20 13:39:01 +00:00
|
|
|
nested_group = create(:group, parent: group)
|
|
|
|
expect(get("/#{name}/#{nested_group.name}")).to route_to('groups#show', id: "#{name}/#{nested_group.name}")
|
2016-11-14 14:55:31 +00:00
|
|
|
end
|
2016-10-07 13:39:57 +00:00
|
|
|
|
2016-11-14 14:55:31 +00:00
|
|
|
it "also display group#show on the short path" do
|
2016-11-21 10:41:44 +00:00
|
|
|
expect(get("/#{name}")).to route_to('groups#show', id: name)
|
2014-04-13 15:46:41 +00:00
|
|
|
end
|
2016-10-16 09:49:23 +00:00
|
|
|
|
2016-11-21 10:41:44 +00:00
|
|
|
it "to #activity" do
|
|
|
|
expect(get("/groups/#{name}/activity")).to route_to('groups#activity', id: name)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "to #issues" do
|
|
|
|
expect(get("/groups/#{name}/issues")).to route_to('groups#issues', id: name)
|
|
|
|
end
|
2016-10-16 09:49:23 +00:00
|
|
|
|
2016-11-21 10:41:44 +00:00
|
|
|
it "to #members" do
|
|
|
|
expect(get("/groups/#{name}/group_members")).to route_to('groups/group_members#index', group_id: name)
|
2016-10-16 09:49:23 +00:00
|
|
|
end
|
2014-04-13 15:46:41 +00:00
|
|
|
end
|
2016-05-10 23:19:16 +00:00
|
|
|
|
|
|
|
describe HealthCheckController, 'routing' do
|
|
|
|
it 'to #index' do
|
|
|
|
expect(get('/health_check')).to route_to('health_check#index')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'also supports passing checks in the url' do
|
|
|
|
expect(get('/health_check/email')).to route_to('health_check#index', checks: 'email')
|
|
|
|
end
|
|
|
|
end
|