Commit 4ef8891e authored by Sean McGivern's avatar Sean McGivern

Merge branch 'groups_routing_priority' into 'master'

Fix routing for paths starting with help and projects

See merge request gitlab-org/gitlab!36048
parents e44a1711 8c8c49f2
---
title: Fix routing for paths starting with help and projects
merge_request: 36048
author:
type: fixed
...@@ -242,6 +242,8 @@ Rails.application.routes.draw do ...@@ -242,6 +242,8 @@ Rails.application.routes.draw do
post :preview_markdown post :preview_markdown
end end
draw :group
resources :projects, only: [:index, :new, :create] resources :projects, only: [:index, :new, :create]
get '/projects/:id' => 'projects#resolve' get '/projects/:id' => 'projects#resolve'
...@@ -258,7 +260,6 @@ Rails.application.routes.draw do ...@@ -258,7 +260,6 @@ Rails.application.routes.draw do
draw :admin draw :admin
draw :profile draw :profile
draw :dashboard draw :dashboard
draw :group
draw :user draw :user
draw :project draw :project
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe "Groups", "routing" do RSpec.shared_examples 'groups routing' do
let(:group_path) { 'complex.group-namegit' } let(:group_path) { 'projects.abc123' }
let!(:group) { create(:group, path: group_path) } let!(:group) { create(:group, path: group_path) }
it "to #show" do it "to #show" do
...@@ -56,3 +56,23 @@ RSpec.describe "Groups", "routing" do ...@@ -56,3 +56,23 @@ RSpec.describe "Groups", "routing" do
expect(get('/groups/gitlabhq/-/boards')).to route_to('groups/boards#index', group_id: 'gitlabhq') expect(get('/groups/gitlabhq/-/boards')).to route_to('groups/boards#index', group_id: 'gitlabhq')
end end
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
...@@ -77,6 +77,10 @@ RSpec.describe 'project routing' do ...@@ -77,6 +77,10 @@ RSpec.describe 'project routing' do
# DELETE /:id(.:format) projects#destroy # DELETE /:id(.:format) projects#destroy
# preview_markdown_project POST /:id/preview_markdown(.:format) projects#preview_markdown # preview_markdown_project POST /:id/preview_markdown(.:format) projects#preview_markdown
describe ProjectsController, 'routing' do describe ProjectsController, 'routing' do
it 'to #index' do
expect(get('/projects')).to route_to('projects#index')
end
it 'to #create' do it 'to #create' do
expect(post('/projects')).to route_to('projects#create') expect(post('/projects')).to route_to('projects#create')
end end
......
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