Commit 3c434a8e authored by Dmytro Zaporozhets's avatar Dmytro Zaporozhets Committed by Michael Kozono

Copy snippet route under - scope

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent d0981554
---
title: Copy snippet route under - scope
merge_request: 35020
author:
type: other
...@@ -262,6 +262,14 @@ Rails.application.routes.draw do ...@@ -262,6 +262,14 @@ Rails.application.routes.draw do
draw :user draw :user
draw :project draw :project
# Serve snippet routes under /-/snippets.
# To ensure an old unscoped routing is used for the UI we need to
# add prefix 'as' to the scope routing and place it below original routing.
# Issue https://gitlab.com/gitlab-org/gitlab/-/issues/210024
scope '-', as: :scoped do
draw :snippets
end
root to: "root#index" root to: "root#index"
get '*unmatched_route', to: 'application#route_not_found' get '*unmatched_route', to: 'application#route_not_found'
......
...@@ -99,6 +99,10 @@ describe SnippetsController, "routing" do ...@@ -99,6 +99,10 @@ describe SnippetsController, "routing" do
it "to #destroy" do 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 end
it 'to #show from scope routing' do
expect(get("/-/snippets/1")).to route_to('snippets#show', id: '1')
end
end end
# help GET /help(.:format) help#index # help GET /help(.:format) help#index
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment