summaryrefslogtreecommitdiff
path: root/spec/validators
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@gitlab.com>2017-04-11 15:51:33 +0200
committerBob Van Landuyt <bob@gitlab.com>2017-05-01 11:14:24 +0200
commitf7511caa5f26c071c61908a48440a95c5f45eb69 (patch)
treed5f9f5206f54c072d04e19d24ff732912f0e80fa /spec/validators
parente4f5b7ca2184473985ef216df676ddb737fb26af (diff)
downloadgitlab-ce-f7511caa5f26c071c61908a48440a95c5f45eb69.tar.gz
Split off validating full paths
The first part of a full path needs to be validated as a `top_level` while the rest need to be validated as `wildcard`
Diffstat (limited to 'spec/validators')
-rw-r--r--spec/validators/namespace_validator_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/validators/namespace_validator_spec.rb b/spec/validators/namespace_validator_spec.rb
index 7ddce74939d..589175a2ced 100644
--- a/spec/validators/namespace_validator_spec.rb
+++ b/spec/validators/namespace_validator_spec.rb
@@ -81,6 +81,26 @@ describe NamespaceValidator do
end
end
+ describe '#valid_full_path' do
+ it "isn't valid when the top level is reserved" do
+ test_path = 'u/should-be-a/reserved-word'
+
+ expect(described_class.valid_full_path?(test_path)).to be(false)
+ end
+
+ it "isn't valid if any of the path segments is reserved" do
+ test_path = 'the-wildcard/wikis/is-a-reserved-path'
+
+ expect(described_class.valid_full_path?(test_path)).to be(false)
+ end
+
+ it "is valid if the path doen't contain reserved words" do
+ test_path = 'there-are/no-wildcards/in-this-path'
+
+ expect(described_class.valid_full_path?(test_path)).to be(true)
+ end
+ end
+
describe '#validation_type' do
it 'uses top level validation for groups without parent' do
group = build(:group)