diff options
author | Bob Van Landuyt <bob@gitlab.com> | 2017-05-02 09:13:10 +0200 |
---|---|---|
committer | Bob Van Landuyt <bob@gitlab.com> | 2017-05-02 09:13:41 +0200 |
commit | c853dd6158af0f77721ce59c03f5f05e98eeadba (patch) | |
tree | 20a68ff2c1092d5655c1f472e67a8890804b3761 /spec/validators | |
parent | 2e2a63c8669a084ed3a3aa5e770158ea2cb43a9d (diff) | |
download | gitlab-ce-c853dd6158af0f77721ce59c03f5f05e98eeadba.tar.gz |
Reuse Gitlab::Regex.full_namespace_regex in the DynamicPathValidator
Diffstat (limited to 'spec/validators')
-rw-r--r-- | spec/validators/dynamic_path_validator_spec.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/spec/validators/dynamic_path_validator_spec.rb b/spec/validators/dynamic_path_validator_spec.rb index f43b4892456..4924706b88e 100644 --- a/spec/validators/dynamic_path_validator_spec.rb +++ b/spec/validators/dynamic_path_validator_spec.rb @@ -129,6 +129,10 @@ describe DynamicPathValidator do expect(subject).not_to match('dashboard') end + it 'matches valid paths with a toplevel word in a different place' do + expect(subject).to match('parent/dashboard/project-path') + end + it 'rejects paths containing a wildcard reserved word' do expect(subject).not_to match('hello/edit') expect(subject).not_to match('hello/edit/in-the-middle') @@ -137,7 +141,6 @@ describe DynamicPathValidator do it 'matches valid paths' do expect(subject).to match('parent/child/project-path') - expect(subject).to match('/parent/child/project-path') end end @@ -185,5 +188,11 @@ describe DynamicPathValidator do expect(described_class.valid?(test_path)).to be_falsey end + + it 'rejects paths that are in an incorrect format' do + test_path = 'incorrect/format.git' + + expect(described_class.valid?(test_path)).to be_falsey + end end end |