summaryrefslogtreecommitdiff
path: root/spec/validators
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@gitlab.com>2017-06-16 12:11:33 +0200
committerBob Van Landuyt <bob@gitlab.com>2017-06-21 16:09:35 +0200
commit79393a351db47afa0df3588b5cdf9fb254c75282 (patch)
treedea2a56eef6c2c3088449de14aea77b235f4d743 /spec/validators
parentcf3cdd48bb4959cb277752a16a4b98b7f4a4f3c4 (diff)
downloadgitlab-ce-79393a351db47afa0df3588b5cdf9fb254c75282.tar.gz
Rebuild the dynamic path before validating itbvl-validate-path-update
Otherwise we won't validate updates to the path. Allowing users to change the path to something that's not allowed.
Diffstat (limited to 'spec/validators')
-rw-r--r--spec/validators/dynamic_path_validator_spec.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/validators/dynamic_path_validator_spec.rb b/spec/validators/dynamic_path_validator_spec.rb
index 8dbf3eecd23..8bd5306ff98 100644
--- a/spec/validators/dynamic_path_validator_spec.rb
+++ b/spec/validators/dynamic_path_validator_spec.rb
@@ -84,5 +84,14 @@ describe DynamicPathValidator do
expect(group.errors[:path]).to include('users is a reserved name')
end
+
+ it 'updating to an invalid path is not allowed' do
+ project = create(:empty_project)
+ project.path = 'update'
+
+ validator.validate_each(project, :path, 'update')
+
+ expect(project.errors[:path]).to include('update is a reserved name')
+ end
end
end