summaryrefslogtreecommitdiff
path: root/spec/routing
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-08-20 18:42:06 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-08-20 18:42:06 +0000
commit6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch)
tree78be5963ec075d80116a932011d695dd33910b4e /spec/routing
parent1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff)
downloadgitlab-ce-6e4e1050d9dba2b7b2523fdd1768823ab85feef4.tar.gz
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'spec/routing')
-rw-r--r--spec/routing/notifications_routing_spec.rb5
-rw-r--r--spec/routing/project_routing_spec.rb82
-rw-r--r--spec/routing/routing_spec.rb24
3 files changed, 87 insertions, 24 deletions
diff --git a/spec/routing/notifications_routing_spec.rb b/spec/routing/notifications_routing_spec.rb
index f545badcdfa..007e8ff4816 100644
--- a/spec/routing/notifications_routing_spec.rb
+++ b/spec/routing/notifications_routing_spec.rb
@@ -10,4 +10,9 @@ RSpec.describe "notifications routing" do
it "routes to #update" do
expect(put("/profile/notifications")).to route_to("profiles/notifications#update")
end
+
+ it 'routes to group #update' do
+ expect(put("/profile/notifications/groups/gitlab-org")).to route_to("profiles/groups#update", id: 'gitlab-org')
+ expect(put("/profile/notifications/groups/gitlab.org")).to route_to("profiles/groups#update", id: 'gitlab.org')
+ end
end
diff --git a/spec/routing/project_routing_spec.rb b/spec/routing/project_routing_spec.rb
index 87091da0c84..b80baf0aa13 100644
--- a/spec/routing/project_routing_spec.rb
+++ b/spec/routing/project_routing_spec.rb
@@ -314,39 +314,39 @@ RSpec.describe 'project routing' do
# DELETE /:project_id/snippets/:id(.:format) snippets#destroy
describe SnippetsController, 'routing' do
it 'to #raw' do
- expect(get('/gitlab/gitlabhq/snippets/1/raw')).to route_to('projects/snippets#raw', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1')
+ expect(get('/gitlab/gitlabhq/-/snippets/1/raw')).to route_to('projects/snippets#raw', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1')
end
it 'to #index' do
- expect(get('/gitlab/gitlabhq/snippets')).to route_to('projects/snippets#index', namespace_id: 'gitlab', project_id: 'gitlabhq')
+ expect(get('/gitlab/gitlabhq/-/snippets')).to route_to('projects/snippets#index', namespace_id: 'gitlab', project_id: 'gitlabhq')
end
it 'to #create' do
- expect(post('/gitlab/gitlabhq/snippets')).to route_to('projects/snippets#create', namespace_id: 'gitlab', project_id: 'gitlabhq')
+ expect(post('/gitlab/gitlabhq/-/snippets')).to route_to('projects/snippets#create', namespace_id: 'gitlab', project_id: 'gitlabhq')
end
it 'to #new' do
- expect(get('/gitlab/gitlabhq/snippets/new')).to route_to('projects/snippets#new', namespace_id: 'gitlab', project_id: 'gitlabhq')
+ expect(get('/gitlab/gitlabhq/-/snippets/new')).to route_to('projects/snippets#new', namespace_id: 'gitlab', project_id: 'gitlabhq')
end
it 'to #edit' do
- expect(get('/gitlab/gitlabhq/snippets/1/edit')).to route_to('projects/snippets#edit', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1')
+ expect(get('/gitlab/gitlabhq/-/snippets/1/edit')).to route_to('projects/snippets#edit', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1')
end
it 'to #show' do
- expect(get('/gitlab/gitlabhq/snippets/1')).to route_to('projects/snippets#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1')
+ expect(get('/gitlab/gitlabhq/-/snippets/1')).to route_to('projects/snippets#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1')
end
it 'to #update' do
- expect(put('/gitlab/gitlabhq/snippets/1')).to route_to('projects/snippets#update', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1')
+ expect(put('/gitlab/gitlabhq/-/snippets/1')).to route_to('projects/snippets#update', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1')
end
it 'to #destroy' do
- expect(delete('/gitlab/gitlabhq/snippets/1')).to route_to('projects/snippets#destroy', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1')
+ 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')
+ it 'to #show from unscope routing' do
+ expect(get('/gitlab/gitlabhq/snippets/1')).to route_to('projects/snippets#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1')
end
end
@@ -823,4 +823,66 @@ RSpec.describe 'project routing' do
project_id: 'gitlabhq', snippet_id: '1', ref: 'master', path: 'lib/version.rb')
end
end
+
+ describe Projects::MetricsDashboardController, 'routing' do
+ it 'routes to #show with no dashboard_path and no page' do
+ expect(get: "/gitlab/gitlabhq/-/metrics").to route_to(
+ "projects/metrics_dashboard#show",
+ **base_params
+ )
+ end
+
+ it 'routes to #show with only dashboard_path' do
+ expect(get: "/gitlab/gitlabhq/-/metrics/dashboard1.yml").to route_to(
+ "projects/metrics_dashboard#show",
+ dashboard_path: 'dashboard1.yml',
+ **base_params
+ )
+ end
+
+ it 'routes to #show with only page' do
+ expect(get: "/gitlab/gitlabhq/-/metrics/panel/new").to route_to(
+ "projects/metrics_dashboard#show",
+ page: 'panel/new',
+ **base_params
+ )
+ end
+
+ it 'routes to #show with dashboard_path and page' do
+ expect(get: "/gitlab/gitlabhq/-/metrics/config%2Fprometheus%2Fcommon_metrics.yml/panel/new").to route_to(
+ "projects/metrics_dashboard#show",
+ dashboard_path: 'config/prometheus/common_metrics.yml',
+ page: 'panel/new',
+ **base_params
+ )
+ end
+
+ it 'routes to 404 with invalid page' do
+ expect(get: "/gitlab/gitlabhq/-/metrics/invalid_page").to route_to(
+ 'application#route_not_found',
+ unmatched_route: 'gitlab/gitlabhq/-/metrics/invalid_page'
+ )
+ end
+
+ it 'routes to 404 with invalid dashboard_path' do
+ expect(get: "/gitlab/gitlabhq/-/metrics/invalid_dashboard").to route_to(
+ 'application#route_not_found',
+ unmatched_route: 'gitlab/gitlabhq/-/metrics/invalid_dashboard'
+ )
+ end
+
+ it 'routes to 404 with invalid dashboard_path and valid page' do
+ expect(get: "/gitlab/gitlabhq/-/metrics/dashboard1/panel/new").to route_to(
+ 'application#route_not_found',
+ unmatched_route: 'gitlab/gitlabhq/-/metrics/dashboard1/panel/new'
+ )
+ end
+
+ it 'routes to 404 with valid dashboard_path and invalid page' do
+ expect(get: "/gitlab/gitlabhq/-/metrics/dashboard1.yml/invalid_page").to route_to(
+ 'application#route_not_found',
+ unmatched_route: 'gitlab/gitlabhq/-/metrics/dashboard1.yml/invalid_page'
+ )
+ end
+ end
end
diff --git a/spec/routing/routing_spec.rb b/spec/routing/routing_spec.rb
index 1218ae30781..af4becd980b 100644
--- a/spec/routing/routing_spec.rb
+++ b/spec/routing/routing_spec.rb
@@ -76,46 +76,45 @@ end
# DELETE /snippets/:id(.:format) snippets#destroy
RSpec.describe SnippetsController, "routing" do
it "to #raw" do
- expect(get("/snippets/1/raw")).to route_to('snippets#raw', id: '1')
+ expect(get("/-/snippets/1/raw")).to route_to('snippets#raw', id: '1')
end
it "to #index" do
- expect(get("/snippets")).to route_to('snippets#index')
+ expect(get("/-/snippets")).to route_to('snippets#index')
end
it "to #create" do
- expect(post("/snippets")).to route_to('snippets#create')
+ expect(post("/-/snippets")).to route_to('snippets#create')
end
it "to #new" do
- expect(get("/snippets/new")).to route_to('snippets#new')
+ expect(get("/-/snippets/new")).to route_to('snippets#new')
end
it "to #edit" do
- expect(get("/snippets/1/edit")).to route_to('snippets#edit', id: '1')
+ expect(get("/-/snippets/1/edit")).to route_to('snippets#edit', id: '1')
end
it "to #show" do
- expect(get("/snippets/1")).to route_to('snippets#show', id: '1')
+ expect(get("/-/snippets/1")).to route_to('snippets#show', id: '1')
end
it "to #update" do
- expect(put("/snippets/1")).to route_to('snippets#update', id: '1')
+ expect(put("/-/snippets/1")).to route_to('snippets#update', id: '1')
end
it "to #destroy" do
- expect(delete("/snippets/1")).to route_to('snippets#destroy', id: '1')
+ 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')
+ it 'to #show from unscoped 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
RSpec.describe HelpController, "routing" do
it "to #index" do
expect(get("/help")).to route_to('help#index')
@@ -131,9 +130,6 @@ RSpec.describe HelpController, "routing" do
expect(get(path)).to route_to('help#show',
path: 'workflow/protected_branches/protected_branches1',
format: 'png')
-
- path = '/help/ui'
- expect(get(path)).to route_to('help#ui')
end
end