Commit fb459ca7 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch 'dz-restrict-reserved-routes-expansion' into 'master'

Add spec on routes regex constants

See merge request gitlab-org/gitlab!30162
parents 9b0488ec 903a446e
...@@ -170,6 +170,11 @@ describe Gitlab::PathRegex do ...@@ -170,6 +170,11 @@ describe Gitlab::PathRegex do
expect(described_class::TOP_LEVEL_ROUTES) expect(described_class::TOP_LEVEL_ROUTES)
.to contain_exactly(*top_level_words), failure_block .to contain_exactly(*top_level_words), failure_block
end end
# We ban new items in this list, see https://gitlab.com/gitlab-org/gitlab/-/issues/215362
it 'does not allow expansion' do
expect(described_class::TOP_LEVEL_ROUTES.size).to eq(41)
end
end end
describe 'GROUP_ROUTES' do describe 'GROUP_ROUTES' do
...@@ -184,6 +189,11 @@ describe Gitlab::PathRegex do ...@@ -184,6 +189,11 @@ describe Gitlab::PathRegex do
expect(described_class::GROUP_ROUTES) expect(described_class::GROUP_ROUTES)
.to contain_exactly(*paths_after_group_id), failure_block .to contain_exactly(*paths_after_group_id), failure_block
end end
# We ban new items in this list, see https://gitlab.com/gitlab-org/gitlab/-/issues/215362
it 'does not allow expansion' do
expect(described_class::GROUP_ROUTES.size).to eq(1)
end
end end
describe 'PROJECT_WILDCARD_ROUTES' do describe 'PROJECT_WILDCARD_ROUTES' do
...@@ -195,6 +205,11 @@ describe Gitlab::PathRegex do ...@@ -195,6 +205,11 @@ describe Gitlab::PathRegex do
end end
end end
end end
# We ban new items in this list, see https://gitlab.com/gitlab-org/gitlab/-/issues/215362
it 'does not allow expansion' do
expect(described_class::PROJECT_WILDCARD_ROUTES.size).to eq(21)
end
end end
describe '.root_namespace_route_regex' do describe '.root_namespace_route_regex' do
......
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