Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-07-20 15:26:25 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-07-20 15:26:25 +0300
commita09983ae35713f5a2bbb100981116d31ce99826e (patch)
tree2ee2af7bd104d57086db360a7e6d8c9d5d43667a /spec/routing
parent18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff)
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'spec/routing')
-rw-r--r--spec/routing/admin/serverless/domains_controller_routing_spec.rb2
-rw-r--r--spec/routing/admin_routing_spec.rb18
-rw-r--r--spec/routing/environments_spec.rb2
-rw-r--r--spec/routing/git_http_routing_spec.rb2
-rw-r--r--spec/routing/group_routing_spec.rb24
-rw-r--r--spec/routing/import_routing_spec.rb63
-rw-r--r--spec/routing/instance_statistics_routing_spec.rb2
-rw-r--r--spec/routing/notifications_routing_spec.rb2
-rw-r--r--spec/routing/openid_connect_spec.rb4
-rw-r--r--spec/routing/project_routing_spec.rb185
-rw-r--r--spec/routing/routing_spec.rb61
-rw-r--r--spec/routing/uploads_routing_spec.rb2
12 files changed, 182 insertions, 185 deletions
diff --git a/spec/routing/admin/serverless/domains_controller_routing_spec.rb b/spec/routing/admin/serverless/domains_controller_routing_spec.rb
index 18c0db6add1..60b60809f4d 100644
--- a/spec/routing/admin/serverless/domains_controller_routing_spec.rb
+++ b/spec/routing/admin/serverless/domains_controller_routing_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-describe Admin::Serverless::DomainsController do
+RSpec.describe Admin::Serverless::DomainsController do
it 'routes to #index' do
expect(get: '/admin/serverless/domains').to route_to('admin/serverless/domains#index')
end
diff --git a/spec/routing/admin_routing_spec.rb b/spec/routing/admin_routing_spec.rb
index 25216b0c712..13e371ad68a 100644
--- a/spec/routing/admin_routing_spec.rb
+++ b/spec/routing/admin_routing_spec.rb
@@ -11,7 +11,7 @@ require 'spec_helper'
# admin_user GET /admin/users/:id(.:format) admin/users#show
# PUT /admin/users/:id(.:format) admin/users#update
# DELETE /admin/users/:id(.:format) admin/users#destroy
-describe Admin::UsersController, "routing" do
+RSpec.describe Admin::UsersController, "routing" do
it "to #block" do
expect(put("/admin/users/1/block")).to route_to('admin/users#block', id: '1')
end
@@ -58,7 +58,7 @@ end
# admin_project GET /admin/projects/:id(.:format) admin/projects#show {id: /[^\/]+/}
# PUT /admin/projects/:id(.:format) admin/projects#update {id: /[^\/]+/}
# DELETE /admin/projects/:id(.:format) admin/projects#destroy {id: /[^\/]+/}
-describe Admin::ProjectsController, "routing" do
+RSpec.describe Admin::ProjectsController, "routing" do
it "to #index" do
expect(get("/admin/projects")).to route_to('admin/projects#index')
end
@@ -75,7 +75,7 @@ end
# admin_hook DELETE /admin/hooks/:id(.:format) admin/hooks#destroy
# PUT /admin/hooks/:id(.:format) admin/hooks#update
# edit_admin_hook GET /admin/hooks/:id(.:format) admin/hooks#edit
-describe Admin::HooksController, "routing" do
+RSpec.describe Admin::HooksController, "routing" do
it "to #test" do
expect(post("/admin/hooks/1/test")).to route_to('admin/hooks#test', id: '1')
end
@@ -103,7 +103,7 @@ end
# admin_hook_hook_log_retry POST /admin/hooks/:hook_id/hook_logs/:id/retry(.:format) admin/hook_logs#retry
# admin_hook_hook_log GET /admin/hooks/:hook_id/hook_logs/:id(.:format) admin/hook_logs#show
-describe Admin::HookLogsController, 'routing' do
+RSpec.describe Admin::HookLogsController, 'routing' do
it 'to #retry' do
expect(post('/admin/hooks/1/hook_logs/1/retry')).to route_to('admin/hook_logs#retry', hook_id: '1', id: '1')
end
@@ -114,27 +114,27 @@ describe Admin::HookLogsController, 'routing' do
end
# admin_background_jobs GET /admin/background_jobs(.:format) admin/background_jobs#show
-describe Admin::BackgroundJobsController, "routing" do
+RSpec.describe Admin::BackgroundJobsController, "routing" do
it "to #show" do
expect(get("/admin/background_jobs")).to route_to('admin/background_jobs#show')
end
end
# admin_root /admin(.:format) admin/dashboard#index
-describe Admin::DashboardController, "routing" do
+RSpec.describe Admin::DashboardController, "routing" do
it "to #index" do
expect(get("/admin")).to route_to('admin/dashboard#index')
end
end
# admin_health_check GET /admin/health_check(.:format) admin/health_check#show
-describe Admin::HealthCheckController, "routing" do
+RSpec.describe Admin::HealthCheckController, "routing" do
it "to #show" do
expect(get("/admin/health_check")).to route_to('admin/health_check#show')
end
end
-describe Admin::GroupsController, "routing" do
+RSpec.describe Admin::GroupsController, "routing" do
let(:name) { 'complex.group-namegit' }
it "to #index" do
@@ -151,7 +151,7 @@ describe Admin::GroupsController, "routing" do
end
end
-describe Admin::SessionsController, "routing" do
+RSpec.describe Admin::SessionsController, "routing" do
it "to #new" do
expect(get("/admin/session/new")).to route_to('admin/sessions#new')
end
diff --git a/spec/routing/environments_spec.rb b/spec/routing/environments_spec.rb
index 46d4f31dd31..5ba02c384e2 100644
--- a/spec/routing/environments_spec.rb
+++ b/spec/routing/environments_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-describe 'environments routing' do
+RSpec.describe 'environments routing' do
let(:project) { create(:project) }
let(:environment) do
diff --git a/spec/routing/git_http_routing_spec.rb b/spec/routing/git_http_routing_spec.rb
index af14e5f81cb..e5216d99eb9 100644
--- a/spec/routing/git_http_routing_spec.rb
+++ b/spec/routing/git_http_routing_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-describe 'git_http routing' do
+RSpec.describe 'git_http routing' do
include RSpec::Rails::RequestExampleGroup
describe 'wiki.git routing', 'routing' do
diff --git a/spec/routing/group_routing_spec.rb b/spec/routing/group_routing_spec.rb
index 2a8454a276d..f4d5f899519 100644
--- a/spec/routing/group_routing_spec.rb
+++ b/spec/routing/group_routing_spec.rb
@@ -2,8 +2,8 @@
require 'spec_helper'
-describe "Groups", "routing" do
- let(:group_path) { 'complex.group-namegit' }
+RSpec.shared_examples 'groups routing' do
+ let(:group_path) { 'projects.abc123' }
let!(:group) { create(:group, path: group_path) }
it "to #show" do
@@ -56,3 +56,23 @@ describe "Groups", "routing" do
expect(get('/groups/gitlabhq/-/boards')).to route_to('groups/boards#index', group_id: 'gitlabhq')
end
end
+
+RSpec.describe "Groups", "routing" do
+ context 'complex group path with dot' do
+ include_examples 'groups routing' do
+ let(:group_path) { 'complex.group-namegit' }
+ end
+ end
+
+ context 'group path starting with help' do
+ include_examples 'groups routing' do
+ let(:group_path) { 'help.abc123' }
+ end
+ end
+
+ context 'group path starting with projects' do
+ include_examples 'groups routing' do
+ let(:group_path) { 'projects.abc123' }
+ end
+ end
+end
diff --git a/spec/routing/import_routing_spec.rb b/spec/routing/import_routing_spec.rb
index 7e78a1c0cd2..15d2f32de78 100644
--- a/spec/routing/import_routing_spec.rb
+++ b/spec/routing/import_routing_spec.rb
@@ -23,7 +23,7 @@ require 'spec_helper'
# let(:actions) { [:index] }
# let(:controller) { 'issues' }
# end
-shared_examples 'importer routing' do
+RSpec.shared_examples 'importer routing' do
let(:except_actions) { [] }
let(:is_realtime) { false }
@@ -62,7 +62,7 @@ end
# realtime_changes_import_github GET /import/github/realtime_changes(.:format) import/github#jobs
# import_github POST /import/github(.:format) import/github#create
# new_import_github GET /import/github/new(.:format) import/github#new
-describe Import::GithubController, 'routing' do
+RSpec.describe Import::GithubController, 'routing' do
it_behaves_like 'importer routing' do
let(:provider) { 'github' }
let(:is_realtime) { true }
@@ -78,7 +78,7 @@ end
# realtime_changes_import_gitea GET /import/gitea/realtime_changes(.:format) import/gitea#jobs
# import_gitea POST /import/gitea(.:format) import/gitea#create
# new_import_gitea GET /import/gitea/new(.:format) import/gitea#new
-describe Import::GiteaController, 'routing' do
+RSpec.describe Import::GiteaController, 'routing' do
it_behaves_like 'importer routing' do
let(:except_actions) { [:callback] }
let(:provider) { 'gitea' }
@@ -90,25 +90,39 @@ describe Import::GiteaController, 'routing' do
end
end
-# status_import_gitlab GET /import/gitlab/status(.:format) import/gitlab#status
-# callback_import_gitlab GET /import/gitlab/callback(.:format) import/gitlab#callback
-# jobs_import_gitlab GET /import/gitlab/jobs(.:format) import/gitlab#jobs
-# import_gitlab POST /import/gitlab(.:format) import/gitlab#create
-describe Import::GitlabController, 'routing' do
+# status_import_gitlab GET /import/gitlab/status(.:format) import/gitlab#status
+# callback_import_gitlab GET /import/gitlab/callback(.:format) import/gitlab#callback
+# realtime_changes_import_gitlab GET /import/gitlab/realtime_changes(.:format) import/gitlab#realtime_changes
+# import_gitlab POST /import/gitlab(.:format) import/gitlab#create
+RSpec.describe Import::GitlabController, 'routing' do
it_behaves_like 'importer routing' do
let(:except_actions) { [:new] }
let(:provider) { 'gitlab' }
+ let(:is_realtime) { true }
end
end
-# status_import_bitbucket GET /import/bitbucket/status(.:format) import/bitbucket#status
-# callback_import_bitbucket GET /import/bitbucket/callback(.:format) import/bitbucket#callback
-# jobs_import_bitbucket GET /import/bitbucket/jobs(.:format) import/bitbucket#jobs
-# import_bitbucket POST /import/bitbucket(.:format) import/bitbucket#create
-describe Import::BitbucketController, 'routing' do
+# status_import_bitbucket GET /import/bitbucket/status(.:format) import/bitbucket#status
+# callback_import_bitbucket GET /import/bitbucket/callback(.:format) import/bitbucket#callback
+# realtime_changes_import_bitbucket GET /import/bitbucket/realtime_changes(.:format) import/bitbucket#realtime_changes
+# import_bitbucket POST /import/bitbucket(.:format) import/bitbucket#create
+RSpec.describe Import::BitbucketController, 'routing' do
it_behaves_like 'importer routing' do
let(:except_actions) { [:new] }
let(:provider) { 'bitbucket' }
+ let(:is_realtime) { true }
+ end
+end
+
+# status_import_bitbucket_server GET /import/bitbucket_server/status(.:format) import/bitbucket_server#status
+# callback_import_bitbucket_server GET /import/bitbucket_server/callback(.:format) import/bitbucket_server#callback
+# realtime_changes_import_bitbucket_server GET /import/bitbucket_server/realtime_changes(.:format) import/bitbucket_server#realtime_changes
+# new_import_bitbucket_server GET /import/bitbucket_server/new(.:format) import/bitbucket_server#new
+# import_bitbucket_server POST /import/bitbucket_server(.:format) import/bitbucket_server#create
+RSpec.describe Import::BitbucketServerController, 'routing' do
+ it_behaves_like 'importer routing' do
+ let(:provider) { 'bitbucket_server' }
+ let(:is_realtime) { true }
end
end
@@ -119,7 +133,7 @@ end
# create_user_map_import_google_code POST /import/google_code/user_map(.:format) import/google_code#create_user_map
# import_google_code POST /import/google_code(.:format) import/google_code#create
# new_import_google_code GET /import/google_code/new(.:format) import/google_code#new
-describe Import::GoogleCodeController, 'routing' do
+RSpec.describe Import::GoogleCodeController, 'routing' do
it_behaves_like 'importer routing' do
let(:except_actions) { [:callback] }
let(:provider) { 'google_code' }
@@ -138,17 +152,18 @@ describe Import::GoogleCodeController, 'routing' do
end
end
-# status_import_fogbugz GET /import/fogbugz/status(.:format) import/fogbugz#status
-# callback_import_fogbugz POST /import/fogbugz/callback(.:format) import/fogbugz#callback
-# jobs_import_fogbugz GET /import/fogbugz/jobs(.:format) import/fogbugz#jobs
-# new_user_map_import_fogbugz GET /import/fogbugz/user_map(.:format) import/fogbugz#new_user_map
-# create_user_map_import_fogbugz POST /import/fogbugz/user_map(.:format) import/fogbugz#create_user_map
-# import_fogbugz POST /import/fogbugz(.:format) import/fogbugz#create
-# new_import_fogbugz GET /import/fogbugz/new(.:format) import/fogbugz#new
-describe Import::FogbugzController, 'routing' do
+# status_import_fogbugz GET /import/fogbugz/status(.:format) import/fogbugz#status
+# callback_import_fogbugz POST /import/fogbugz/callback(.:format) import/fogbugz#callback
+# realtime_changes_import_fogbugz GET /import/fogbugz/realtime_changes(.:format) import/fogbugz#realtime_changes
+# new_user_map_import_fogbugz GET /import/fogbugz/user_map(.:format) import/fogbugz#new_user_map
+# create_user_map_import_fogbugz POST /import/fogbugz/user_map(.:format) import/fogbugz#create_user_map
+# import_fogbugz POST /import/fogbugz(.:format) import/fogbugz#create
+# new_import_fogbugz GET /import/fogbugz/new(.:format) import/fogbugz#new
+RSpec.describe Import::FogbugzController, 'routing' do
it_behaves_like 'importer routing' do
let(:except_actions) { [:callback] }
let(:provider) { 'fogbugz' }
+ let(:is_realtime) { true }
end
it 'to #callback' do
@@ -167,7 +182,7 @@ end
# import_gitlab_project POST /import/gitlab_project(.:format) import/gitlab_projects#create
# POST /import/gitlab_project(.:format) import/gitlab_projects#create
# new_import_gitlab_project GET /import/gitlab_project/new(.:format) import/gitlab_projects#new
-describe Import::GitlabProjectsController, 'routing' do
+RSpec.describe Import::GitlabProjectsController, 'routing' do
it 'to #create' do
expect(post('/import/gitlab_project')).to route_to('import/gitlab_projects#create')
end
@@ -179,7 +194,7 @@ end
# new_import_phabricator GET /import/phabricator/new(.:format) import/phabricator#new
# import_phabricator POST /import/phabricator(.:format) import/phabricator#create
-describe Import::PhabricatorController, 'routing' do
+RSpec.describe Import::PhabricatorController, 'routing' do
it 'to #create' do
expect(post("/import/phabricator")).to route_to("import/phabricator#create")
end
diff --git a/spec/routing/instance_statistics_routing_spec.rb b/spec/routing/instance_statistics_routing_spec.rb
index 48a3ac4695c..7793c5cce71 100644
--- a/spec/routing/instance_statistics_routing_spec.rb
+++ b/spec/routing/instance_statistics_routing_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-describe 'Instance Statistics', 'routing' do
+RSpec.describe 'Instance Statistics', 'routing' do
include RSpec::Rails::RequestExampleGroup
it "routes '/-/instance_statistics' to dev ops score" do
diff --git a/spec/routing/notifications_routing_spec.rb b/spec/routing/notifications_routing_spec.rb
index 8c2b29aabcb..f545badcdfa 100644
--- a/spec/routing/notifications_routing_spec.rb
+++ b/spec/routing/notifications_routing_spec.rb
@@ -2,7 +2,7 @@
require "spec_helper"
-describe "notifications routing" do
+RSpec.describe "notifications routing" do
it "routes to #show" do
expect(get("/profile/notifications")).to route_to("profiles/notifications#show")
end
diff --git a/spec/routing/openid_connect_spec.rb b/spec/routing/openid_connect_spec.rb
index fc170f8986c..b5291953730 100644
--- a/spec/routing/openid_connect_spec.rb
+++ b/spec/routing/openid_connect_spec.rb
@@ -6,7 +6,7 @@ require 'spec_helper'
# jwks GET /-/jwks(.:format) doorkeeper/openid_connect/discovery#keys
# oauth_discovery_provider GET /.well-known/openid-configuration(.:format) doorkeeper/openid_connect/discovery#provider
# oauth_discovery_webfinger GET /.well-known/webfinger(.:format) doorkeeper/openid_connect/discovery#webfinger
-describe Doorkeeper::OpenidConnect::DiscoveryController, 'routing' do
+RSpec.describe Doorkeeper::OpenidConnect::DiscoveryController, 'routing' do
it "to #provider" do
expect(get('/.well-known/openid-configuration')).to route_to('doorkeeper/openid_connect/discovery#provider')
end
@@ -26,7 +26,7 @@ end
# oauth_userinfo GET /oauth/userinfo(.:format) doorkeeper/openid_connect/userinfo#show
# POST /oauth/userinfo(.:format) doorkeeper/openid_connect/userinfo#show
-describe Doorkeeper::OpenidConnect::UserinfoController, 'routing' do
+RSpec.describe Doorkeeper::OpenidConnect::UserinfoController, 'routing' do
it "to #show" do
expect(get('/oauth/userinfo')).to route_to('doorkeeper/openid_connect/userinfo#show')
end
diff --git a/spec/routing/project_routing_spec.rb b/spec/routing/project_routing_spec.rb
index 6150a9637c7..87091da0c84 100644
--- a/spec/routing/project_routing_spec.rb
+++ b/spec/routing/project_routing_spec.rb
@@ -2,72 +2,14 @@
require 'spec_helper'
-describe 'project routing' do
+RSpec.describe 'project routing' do
+ let(:base_params) { { namespace_id: 'gitlab', project_id: 'gitlabhq' } }
+
before do
allow(Project).to receive(:find_by_full_path).and_return(false)
allow(Project).to receive(:find_by_full_path).with('gitlab/gitlabhq', any_args).and_return(true)
end
- # Shared examples for a resource inside a Project
- #
- # By default it tests all the default REST actions: index, create, new, edit,
- # show, update, and destroy. You can remove actions by customizing the
- # `actions` variable.
- #
- # It also expects a `controller` variable to be available which defines both
- # the path to the resource as well as the controller name.
- #
- # Examples
- #
- # # Default behavior
- # it_behaves_like 'RESTful project resources' do
- # let(:controller) { 'issues' }
- # end
- #
- # # Customizing actions
- # it_behaves_like 'RESTful project resources' do
- # let(:actions) { [:index] }
- # let(:controller) { 'issues' }
- # end
- #
- # # Different controller name and path
- # it_behaves_like 'RESTful project resources' do
- # let(:controller) { 'pages_domains' }
- # let(:controller_path) { 'pages/domains' }
- # end
- shared_examples 'RESTful project resources' do
- let(:actions) { [:index, :create, :new, :edit, :show, :update, :destroy] }
- let(:controller_path) { controller }
-
- it 'to #index' do
- expect(get("/gitlab/gitlabhq/#{controller_path}")).to route_to("projects/#{controller}#index", namespace_id: 'gitlab', project_id: 'gitlabhq') if actions.include?(:index)
- end
-
- it 'to #create' do
- expect(post("/gitlab/gitlabhq/#{controller_path}")).to route_to("projects/#{controller}#create", namespace_id: 'gitlab', project_id: 'gitlabhq') if actions.include?(:create)
- end
-
- it 'to #new' do
- expect(get("/gitlab/gitlabhq/#{controller_path}/new")).to route_to("projects/#{controller}#new", namespace_id: 'gitlab', project_id: 'gitlabhq') if actions.include?(:new)
- end
-
- it 'to #edit' do
- expect(get("/gitlab/gitlabhq/#{controller_path}/1/edit")).to route_to("projects/#{controller}#edit", namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1') if actions.include?(:edit)
- end
-
- it 'to #show' do
- expect(get("/gitlab/gitlabhq/#{controller_path}/1")).to route_to("projects/#{controller}#show", namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1') if actions.include?(:show)
- end
-
- it 'to #update' do
- expect(put("/gitlab/gitlabhq/#{controller_path}/1")).to route_to("projects/#{controller}#update", namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1') if actions.include?(:update)
- end
-
- it 'to #destroy' do
- expect(delete("/gitlab/gitlabhq/#{controller_path}/1")).to route_to("projects/#{controller}#destroy", namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1') if actions.include?(:destroy)
- end
- end
-
# projects POST /projects(.:format) projects#create
# new_project GET /projects/new(.:format) projects#new
# files_project GET /:id/files(.:format) projects#files
@@ -77,6 +19,10 @@ describe 'project routing' do
# DELETE /:id(.:format) projects#destroy
# preview_markdown_project POST /:id/preview_markdown(.:format) projects#preview_markdown
describe ProjectsController, 'routing' do
+ it 'to #index' do
+ expect(get('/projects')).to route_to('projects#index')
+ end
+
it 'to #create' do
expect(post('/projects')).to route_to('projects#create')
end
@@ -145,25 +91,19 @@ describe 'project routing' do
end
end
- # pages_project_wikis GET /:project_id/wikis/pages(.:format) projects/wikis#pages
- # history_project_wiki GET /:project_id/wikis/:id/history(.:format) projects/wikis#history
- # project_wikis POST /:project_id/wikis(.:format) projects/wikis#create
- # edit_project_wiki GET /:project_id/wikis/:id/edit(.:format) projects/wikis#edit
- # project_wiki GET /:project_id/wikis/:id(.:format) projects/wikis#show
- # DELETE /:project_id/wikis/:id(.:format) projects/wikis#destroy
+ # project_wikis_git_access GET /:project_id/-/wikis/git_access(.:format) projects/wikis#git_access
+ # project_wikis_pages GET /:project_id/-/wikis/pages(.:format) projects/wikis#pages
+ # project_wikis_new GET /:project_id/-/wikis/new(.:format) projects/wikis#new
+ # POST /:project_id/-/wikis(.:format) projects/wikis#create
+ # project_wiki_edit GET /:project_id/-/wikis/*id/edit projects/wikis#edit
+ # project_wiki_history GET /:project_id/-/wikis/*id/history projects/wikis#history
+ # project_wiki_preview_markdown POST /:project_id/-/wikis/*id/preview_markdown projects/wikis#preview_markdown
+ # project_wiki GET /:project_id/-/wikis/*id projects/wikis#show
+ # PUT /:project_id/-/wikis/*id projects/wikis#update
+ # DELETE /:project_id/-/wikis/*id projects/wikis#destroy
describe Projects::WikisController, 'routing' do
- it 'to #pages' do
- expect(get('/gitlab/gitlabhq/-/wikis/pages')).to route_to('projects/wikis#pages', namespace_id: 'gitlab', project_id: 'gitlabhq')
- end
-
- it 'to #history' do
- expect(get('/gitlab/gitlabhq/-/wikis/1/history')).to route_to('projects/wikis#history', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1')
- end
-
- it_behaves_like 'RESTful project resources' do
- let(:actions) { [:create, :edit, :show, :destroy] }
- let(:controller) { 'wikis' }
- let(:controller_path) { '/-/wikis' }
+ it_behaves_like 'wiki routing' do
+ let(:base_path) { '/gitlab/gitlabhq/-/wikis' }
end
it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/wikis", "/gitlab/gitlabhq/-/wikis"
@@ -242,10 +182,9 @@ describe 'project routing' do
# project_deploy_key PATCH /:project_id/deploy_keys/:id(.:format) deploy_keys#update
# DELETE /:project_id/deploy_keys/:id(.:format) deploy_keys#destroy
describe Projects::DeployKeysController, 'routing' do
- it_behaves_like 'RESTful project resources' do
- let(:actions) { [:index, :new, :create, :edit, :update] }
- let(:controller) { 'deploy_keys' }
- let(:controller_path) { '/-/deploy_keys' }
+ it_behaves_like 'resource routing' do
+ let(:actions) { %i[index new create edit update] }
+ let(:base_path) { '/gitlab/gitlabhq/-/deploy_keys' }
end
end
@@ -253,10 +192,9 @@ describe 'project routing' do
# POST /:project_id/protected_branches(.:format) protected_branches#create
# project_protected_branch DELETE /:project_id/protected_branches/:id(.:format) protected_branches#destroy
describe Projects::ProtectedBranchesController, 'routing' do
- it_behaves_like 'RESTful project resources' do
- let(:actions) { [:index, :create, :destroy] }
- let(:controller) { 'protected_branches' }
- let(:controller_path) { '/-/protected_branches' }
+ it_behaves_like 'resource routing' do
+ let(:actions) { %i[index create destroy] }
+ let(:base_path) { '/gitlab/gitlabhq/-/protected_branches' }
end
end
@@ -316,10 +254,9 @@ describe 'project routing' do
expect(get('/gitlab/gitlabhq/-/merge_requests/1/diffs')).to route_to('projects/merge_requests#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1', tab: 'diffs')
end
- it_behaves_like 'RESTful project resources' do
- let(:controller) { 'merge_requests' }
- let(:actions) { [:index, :edit, :show, :update] }
- let(:controller_path) { '/-/merge_requests' }
+ it_behaves_like 'resource routing' do
+ let(:actions) { %i[index edit show update] }
+ let(:base_path) { '/gitlab/gitlabhq/-/merge_requests' }
end
it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/merge_requests", "/gitlab/gitlabhq/-/merge_requests"
@@ -407,6 +344,10 @@ describe 'project routing' do
it 'to #destroy' do
expect(delete('/gitlab/gitlabhq/snippets/1')).to route_to('projects/snippets#destroy', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1')
end
+
+ it 'to #show from scope routing' do
+ expect(get('/gitlab/gitlabhq/-/snippets/1')).to route_to('projects/snippets#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1')
+ end
end
# test_project_hook POST /:project_id/hooks/:id/test(.:format) hooks#test
@@ -420,9 +361,9 @@ describe 'project routing' do
expect(post('/gitlab/gitlabhq/hooks/1/test')).to route_to('projects/hooks#test', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1')
end
- it_behaves_like 'RESTful project resources' do
- let(:actions) { [:index, :create, :destroy, :edit, :update] }
- let(:controller) { 'hooks' }
+ it_behaves_like 'resource routing' do
+ let(:actions) { %i[index create destroy edit update] }
+ let(:base_path) { '/gitlab/gitlabhq/hooks' }
end
end
@@ -457,10 +398,9 @@ describe 'project routing' do
# POST /:project_id/commits(.:format) commits#create
# project_commit GET /:project_id/commits/:id(.:format) commits#show
describe Projects::CommitsController, 'routing' do
- it_behaves_like 'RESTful project resources' do
- let(:actions) { [:show] }
- let(:controller) { 'commits' }
- let(:controller_path) { '/-/commits' }
+ it_behaves_like 'resource routing' do
+ let(:actions) { %i[show] }
+ let(:base_path) { '/gitlab/gitlabhq/-/commits' }
end
it 'to #show' do
@@ -477,10 +417,9 @@ describe 'project routing' do
# PUT /:project_id/project_members/:id(.:format) project_members#update
# DELETE /:project_id/project_members/:id(.:format) project_members#destroy
describe Projects::ProjectMembersController, 'routing' do
- it_behaves_like 'RESTful project resources' do
- let(:actions) { [:index, :create, :update, :destroy] }
- let(:controller) { 'project_members' }
- let(:controller_path) { '/-/project_members' }
+ it_behaves_like 'resource routing' do
+ let(:actions) { %i[index create update destroy] }
+ let(:base_path) { '/gitlab/gitlabhq/-/project_members' }
end
end
@@ -493,10 +432,9 @@ describe 'project routing' do
# DELETE /:project_id/milestones/:id(.:format) milestones#destroy
# promote_project_milestone POST /:project_id/milestones/:id/promote milestones#promote
describe Projects::MilestonesController, 'routing' do
- it_behaves_like 'RESTful project resources' do
- let(:controller) { 'milestones' }
- let(:actions) { [:index, :create, :new, :edit, :show, :update] }
- let(:controller_path) { '/-/milestones' }
+ it_behaves_like 'resource routing' do
+ let(:actions) { %i[index create new edit show update] }
+ let(:base_path) { '/gitlab/gitlabhq/-/milestones' }
end
it 'to #promote' do
@@ -526,10 +464,9 @@ describe 'project routing' do
expect(post('/gitlab/gitlabhq/-/issues/bulk_update')).to route_to('projects/issues#bulk_update', namespace_id: 'gitlab', project_id: 'gitlabhq')
end
- it_behaves_like 'RESTful project resources' do
- let(:controller) { 'issues' }
- let(:actions) { [:index, :create, :new, :edit, :show, :update] }
- let(:controller_path) { '/-/issues' }
+ it_behaves_like 'resource routing' do
+ let(:actions) { %i[index create new edit show update] }
+ let(:base_path) { '/gitlab/gitlabhq/-/issues' }
end
it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/issues", "/gitlab/gitlabhq/-/issues"
@@ -550,9 +487,9 @@ describe 'project routing' do
)
end
- it_behaves_like 'RESTful project resources' do
- let(:actions) { [:create, :destroy] }
- let(:controller) { 'notes' }
+ it_behaves_like 'resource routing' do
+ let(:actions) { %i[create destroy] }
+ let(:base_path) { '/gitlab/gitlabhq/notes' }
end
end
@@ -741,10 +678,10 @@ describe 'project routing' do
end
describe Projects::PagesDomainsController, 'routing' do
- it_behaves_like 'RESTful project resources' do
- let(:actions) { [:show, :new, :create, :destroy] }
- let(:controller) { 'pages_domains' }
- let(:controller_path) { 'pages/domains' }
+ it_behaves_like 'resource routing' do
+ let(:actions) { %i[show new create destroy] }
+ let(:base_path) { '/gitlab/gitlabhq/pages/domains' }
+ let(:id) { 'my.domain.com' }
end
it 'to #destroy with a valid domain name' do
@@ -778,6 +715,12 @@ describe 'project routing' do
end
end
+ describe Projects::Settings::OperationsController, 'routing' do
+ it 'to #reset_alerting_token' do
+ expect(post('/gitlab/gitlabhq/-/settings/operations/reset_alerting_token')).to route_to('projects/settings/operations#reset_alerting_token', namespace_id: 'gitlab', project_id: 'gitlabhq')
+ end
+ end
+
describe Projects::Settings::RepositoryController, 'routing' do
it 'to #show' do
expect(get('/gitlab/gitlabhq/-/settings/repository')).to route_to('projects/settings/repository#show', namespace_id: 'gitlab', project_id: 'gitlabhq')
@@ -872,4 +815,12 @@ describe 'project routing' do
expect(get('/gitlab/gitlabhq/-/design_management/designs/1/c6f00aa50b80887ada30a6fe517670be9f8f9ece/resized_image/small')).to route_to('application#route_not_found', unmatched_route: 'gitlab/gitlabhq/-/design_management/designs/1/c6f00aa50b80887ada30a6fe517670be9f8f9ece/resized_image/small')
end
end
+
+ describe Projects::Snippets::BlobsController, "routing" do
+ it "to #raw" do
+ expect(get('/gitlab/gitlabhq/-/snippets/1/raw/master/lib/version.rb'))
+ .to route_to('projects/snippets/blobs#raw', namespace_id: 'gitlab',
+ project_id: 'gitlabhq', snippet_id: '1', ref: 'master', path: 'lib/version.rb')
+ end
+ end
end
diff --git a/spec/routing/routing_spec.rb b/spec/routing/routing_spec.rb
index 9c3d17f7d8f..1218ae30781 100644
--- a/spec/routing/routing_spec.rb
+++ b/spec/routing/routing_spec.rb
@@ -9,7 +9,7 @@ require 'spec_helper'
# user_snippets GET /users/:username/snippets(.:format)
# user_calendar GET /users/:username/calendar(.:format)
# user_calendar_activities GET /users/:username/calendar_activities(.:format)
-describe UsersController, "routing" do
+RSpec.describe UsersController, "routing" do
it "to #show" do
allow_any_instance_of(::Constraints::UserUrlConstrainer).to receive(:matches?).and_return(true)
@@ -32,6 +32,13 @@ describe UsersController, "routing" do
expect(get("/users/User/snippets")).to route_to('users#snippets', username: 'User')
end
+ # get all the ssh-keys of a user
+ it "to #get_keys" do
+ allow_any_instance_of(::Constraints::UserUrlConstrainer).to receive(:matches?).and_return(true)
+
+ expect(get("/User.keys")).to route_to('users#ssh_keys', username: 'User')
+ end
+
it "to #calendar" do
expect(get("/users/User/calendar")).to route_to('users#calendar', username: 'User')
end
@@ -42,7 +49,7 @@ describe UsersController, "routing" do
end
# search GET /search(.:format) search#show
-describe SearchController, "routing" do
+RSpec.describe SearchController, "routing" do
it "to #show" do
expect(get("/search")).to route_to('search#show')
end
@@ -50,7 +57,7 @@ end
# gitlab_api /api API::API
# /:path Grack
-describe "Mounted Apps", "routing" do
+RSpec.describe "Mounted Apps", "routing" do
it "to API" do
expect(get("/api/issues")).to be_routable
end
@@ -67,7 +74,7 @@ end
# snippet GET /snippets/:id(.:format) snippets#show
# PUT /snippets/:id(.:format) snippets#update
# DELETE /snippets/:id(.:format) snippets#destroy
-describe SnippetsController, "routing" do
+RSpec.describe SnippetsController, "routing" do
it "to #raw" do
expect(get("/snippets/1/raw")).to route_to('snippets#raw', id: '1')
end
@@ -99,13 +106,17 @@ describe SnippetsController, "routing" do
it "to #destroy" do
expect(delete("/snippets/1")).to route_to('snippets#destroy', id: '1')
end
+
+ it 'to #show from scope routing' do
+ expect(get("/-/snippets/1")).to route_to('snippets#show', id: '1')
+ end
end
# help GET /help(.:format) help#index
# help_page GET /help/*path(.:format) help#show
# help_shortcuts GET /help/shortcuts(.:format) help#shortcuts
# help_ui GET /help/ui(.:format) help#ui
-describe HelpController, "routing" do
+RSpec.describe HelpController, "routing" do
it "to #index" do
expect(get("/help")).to route_to('help#index')
end
@@ -132,7 +143,7 @@ end
# profile_token GET /profile/token(.:format) profile#token
# profile GET /profile(.:format) profile#show
# profile_update PUT /profile/update(.:format) profile#update
-describe ProfilesController, "routing" do
+RSpec.describe ProfilesController, "routing" do
it "to #account" do
expect(get("/profile/account")).to route_to('profiles/accounts#show')
end
@@ -153,7 +164,7 @@ 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
+RSpec.describe Profiles::PreferencesController, 'routing' do
it 'to #show' do
expect(get('/profile/preferences')).to route_to('profiles/preferences#show')
end
@@ -170,7 +181,7 @@ end
# key GET /keys/:id(.:format) keys#show
# PUT /keys/:id(.:format) keys#update
# DELETE /keys/:id(.:format) keys#destroy
-describe Profiles::KeysController, "routing" do
+RSpec.describe Profiles::KeysController, "routing" do
it "to #index" do
expect(get("/profile/keys")).to route_to('profiles/keys#index')
end
@@ -186,19 +197,12 @@ describe Profiles::KeysController, "routing" do
it "to #destroy" do
expect(delete("/profile/keys/1")).to route_to('profiles/keys#destroy', id: '1')
end
-
- # get all the ssh-keys of a user
- it "to #get_keys" do
- allow_any_instance_of(::Constraints::UserUrlConstrainer).to receive(:matches?).and_return(true)
-
- expect(get("/foo.keys")).to route_to('profiles/keys#get_keys', username: 'foo')
- end
end
# emails GET /emails(.:format) emails#index
# POST /keys(.:format) emails#create
# DELETE /keys/:id(.:format) keys#destroy
-describe Profiles::EmailsController, "routing" do
+RSpec.describe Profiles::EmailsController, "routing" do
it "to #index" do
expect(get("/profile/emails")).to route_to('profiles/emails#index')
end
@@ -213,7 +217,7 @@ describe Profiles::EmailsController, "routing" do
end
# profile_avatar DELETE /profile/avatar(.:format) profiles/avatars#destroy
-describe Profiles::AvatarsController, "routing" do
+RSpec.describe Profiles::AvatarsController, "routing" do
it "to #destroy" do
expect(delete("/profile/avatar")).to route_to('profiles/avatars#destroy')
end
@@ -222,7 +226,7 @@ end
# dashboard GET /dashboard(.:format) dashboard#show
# dashboard_issues GET /dashboard/issues(.:format) dashboard#issues
# dashboard_merge_requests GET /dashboard/merge_requests(.:format) dashboard#merge_requests
-describe DashboardController, "routing" do
+RSpec.describe DashboardController, "routing" do
it "to #index" do
expect(get("/dashboard")).to route_to('dashboard/projects#index')
end
@@ -241,13 +245,13 @@ describe DashboardController, "routing" do
end
# root / root#show
-describe RootController, 'routing' do
+RSpec.describe RootController, 'routing' do
it 'to #index' do
expect(get('/')).to route_to('root#index')
end
end
-describe "Authentication", "routing" do
+RSpec.describe "Authentication", "routing" do
it "GET /users/sign_in" do
expect(get("/users/sign_in")).to route_to('sessions#new')
end
@@ -304,7 +308,7 @@ describe "Authentication", "routing" do
end
end
-describe HealthCheckController, 'routing' do
+RSpec.describe HealthCheckController, 'routing' do
it 'to #index' do
expect(get('/health_check')).to route_to('health_check#index')
end
@@ -314,7 +318,7 @@ describe HealthCheckController, 'routing' do
end
end
-describe InvitesController, 'routing' do
+RSpec.describe InvitesController, 'routing' do
let_it_be(:member) { create(:project_member, :invited) }
it 'to #show' do
@@ -326,7 +330,7 @@ describe InvitesController, 'routing' do
end
end
-describe AbuseReportsController, 'routing' do
+RSpec.describe AbuseReportsController, 'routing' do
let_it_be(:user) { create(:user) }
it 'to #new' do
@@ -338,14 +342,14 @@ describe AbuseReportsController, 'routing' do
end
end
-describe SentNotificationsController, 'routing' do
+RSpec.describe SentNotificationsController, 'routing' do
it 'to #unsubscribe' do
expect(get("/-/sent_notifications/4bee17d4a63ed60cf5db53417e9aeb4c/unsubscribe"))
.to route_to('sent_notifications#unsubscribe', id: '4bee17d4a63ed60cf5db53417e9aeb4c')
end
end
-describe AutocompleteController, 'routing' do
+RSpec.describe AutocompleteController, 'routing' do
it 'to #users' do
expect(get("/-/autocomplete/users")).to route_to('autocomplete#users')
end
@@ -368,3 +372,10 @@ describe AutocompleteController, 'routing' do
expect(get("/autocomplete/award_emojis")).to route_to('autocomplete#award_emojis')
end
end
+
+RSpec.describe Snippets::BlobsController, "routing" do
+ it "to #raw" do
+ expect(get('/-/snippets/1/raw/master/lib/version.rb'))
+ .to route_to('snippets/blobs#raw', snippet_id: '1', ref: 'master', path: 'lib/version.rb')
+ end
+end
diff --git a/spec/routing/uploads_routing_spec.rb b/spec/routing/uploads_routing_spec.rb
index f94ae81eeb5..d1ddf8a6d6a 100644
--- a/spec/routing/uploads_routing_spec.rb
+++ b/spec/routing/uploads_routing_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-describe 'Uploads', 'routing' do
+RSpec.describe 'Uploads', 'routing' do
it 'allows creating uploads for personal snippets' do
expect(post('/uploads/personal_snippet?id=1')).to route_to(
controller: 'uploads',