diff options
author | Bob Van Landuyt <bob@gitlab.com> | 2017-04-05 15:41:00 +0200 |
---|---|---|
committer | Bob Van Landuyt <bob@gitlab.com> | 2017-05-01 11:14:24 +0200 |
commit | 74fcccaab30ac0f9e11ed9a076c008ade13a50d0 (patch) | |
tree | e3341f6aa020659655b2b6941fe8660befe315bf /spec/lib/constraints | |
parent | 536f2bdfd17ac3bab38851de2973dd1c89dccc3f (diff) | |
download | gitlab-ce-74fcccaab30ac0f9e11ed9a076c008ade13a50d0.tar.gz |
Streamline the path validation in groups & projects
`Project` uses `ProjectPathValidator` which is now a
`NamespaceValidator` that skips the format validation.
That way we're sure we are using the same collection of reserved
paths.
I updated the path constraints to reflect the changes: We now allow
some values that are only used on a top level namespace as a name for
a nested group/project.
Diffstat (limited to 'spec/lib/constraints')
-rw-r--r-- | spec/lib/constraints/group_url_constrainer_spec.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/lib/constraints/group_url_constrainer_spec.rb b/spec/lib/constraints/group_url_constrainer_spec.rb index 96dacdc5cd2..f95adf3a84b 100644 --- a/spec/lib/constraints/group_url_constrainer_spec.rb +++ b/spec/lib/constraints/group_url_constrainer_spec.rb @@ -17,6 +17,13 @@ describe GroupUrlConstrainer, lib: true do it { expect(subject.matches?(request)).to be_truthy } end + context 'valid request for nested group with reserved top level name' do + let!(:nested_group) { create(:group, path: 'api', parent: group) } + let!(:request) { build_request('gitlab/api') } + + it { expect(subject.matches?(request)).to be_truthy } + end + context 'invalid request' do let(:request) { build_request('foo') } |