diff options
author | Bob Van Landuyt <bob@gitlab.com> | 2017-06-16 13:11:33 +0300 |
---|---|---|
committer | Bob Van Landuyt <bob@gitlab.com> | 2017-06-21 17:09:35 +0300 |
commit | 79393a351db47afa0df3588b5cdf9fb254c75282 (patch) | |
tree | dea2a56eef6c2c3088449de14aea77b235f4d743 /spec | |
parent | cf3cdd48bb4959cb277752a16a4b98b7f4a4f3c4 (diff) |
Rebuild the dynamic path before validating it
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')
-rw-r--r-- | spec/validators/dynamic_path_validator_spec.rb | 9 |
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 |