From 70d8b0d6df151f209dee1fc6ea81bb4357cd2136 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 22 Apr 2020 15:47:13 +0300 Subject: [PATCH 1/4] Add spec on routes regex constants Signed-off-by: Dmitriy Zaporozhets --- spec/lib/gitlab/path_regex_spec.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/spec/lib/gitlab/path_regex_spec.rb b/spec/lib/gitlab/path_regex_spec.rb index 8dabe5a756b9b9..3db61dd1d67063 100644 --- a/spec/lib/gitlab/path_regex_spec.rb +++ b/spec/lib/gitlab/path_regex_spec.rb @@ -170,6 +170,10 @@ def failure_message(constant_name, migration_helper, missing_words: [], addition expect(described_class::TOP_LEVEL_ROUTES) .to contain_exactly(*top_level_words), failure_block end + + it 'does not allow expansion' do + expect(described_class::TOP_LEVEL_ROUTES.size).to eq(41) + end end describe 'GROUP_ROUTES' do @@ -184,6 +188,10 @@ def failure_message(constant_name, migration_helper, missing_words: [], addition expect(described_class::GROUP_ROUTES) .to contain_exactly(*paths_after_group_id), failure_block end + + it 'does not allow expansion' do + expect(described_class::GROUP_ROUTES.size).to eq(1) + end end describe 'PROJECT_WILDCARD_ROUTES' do @@ -195,6 +203,10 @@ def failure_message(constant_name, migration_helper, missing_words: [], addition end end end + + it 'does not allow expansion' do + expect(described_class::PROJECT_WILDCARD_ROUTES.size).to eq(21) + end end describe '.root_namespace_route_regex' do -- GitLab From 665759ddbff395ffd7aa65afdb04f5d7822d8223 Mon Sep 17 00:00:00 2001 From: Dmytro Zaporozhets Date: Thu, 23 Apr 2020 11:47:57 +0000 Subject: [PATCH 2/4] Apply suggestion to spec/lib/gitlab/path_regex_spec.rb --- spec/lib/gitlab/path_regex_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/lib/gitlab/path_regex_spec.rb b/spec/lib/gitlab/path_regex_spec.rb index 3db61dd1d67063..bf4b815ee15418 100644 --- a/spec/lib/gitlab/path_regex_spec.rb +++ b/spec/lib/gitlab/path_regex_spec.rb @@ -189,6 +189,7 @@ def failure_message(constant_name, migration_helper, missing_words: [], addition .to contain_exactly(*paths_after_group_id), failure_block 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 -- GitLab From bef1f58f70787aafd09c49c779b4ad6bc998ef58 Mon Sep 17 00:00:00 2001 From: Dmytro Zaporozhets Date: Thu, 23 Apr 2020 11:48:10 +0000 Subject: [PATCH 3/4] Apply suggestion to spec/lib/gitlab/path_regex_spec.rb --- spec/lib/gitlab/path_regex_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/lib/gitlab/path_regex_spec.rb b/spec/lib/gitlab/path_regex_spec.rb index bf4b815ee15418..dfcd66566a3e86 100644 --- a/spec/lib/gitlab/path_regex_spec.rb +++ b/spec/lib/gitlab/path_regex_spec.rb @@ -171,6 +171,7 @@ def failure_message(constant_name, migration_helper, missing_words: [], addition .to contain_exactly(*top_level_words), failure_block 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 -- GitLab From f35f4fddaa995042a86436e0c25b84393e88ad5d Mon Sep 17 00:00:00 2001 From: Dmytro Zaporozhets Date: Thu, 23 Apr 2020 11:48:41 +0000 Subject: [PATCH 4/4] Apply suggestion to spec/lib/gitlab/path_regex_spec.rb --- spec/lib/gitlab/path_regex_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/lib/gitlab/path_regex_spec.rb b/spec/lib/gitlab/path_regex_spec.rb index dfcd66566a3e86..50b045c6aad47b 100644 --- a/spec/lib/gitlab/path_regex_spec.rb +++ b/spec/lib/gitlab/path_regex_spec.rb @@ -206,6 +206,7 @@ def failure_message(constant_name, migration_helper, missing_words: [], addition 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 -- GitLab