summaryrefslogtreecommitdiff
path: root/spec/validators
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2018-01-31 11:39:03 -0600
committerDouwe Maan <douwe@selenight.nl>2018-02-06 12:09:03 -0600
commita03d29da1dbbef3c202899cef3cd89b453a8b76f (patch)
tree83f08b67027f9169eac9dfbc6a4c19f1752ad9ff /spec/validators
parent75144b1e03db342730535f1f49b0e7cd2987d755 (diff)
downloadgitlab-ce-a03d29da1dbbef3c202899cef3cd89b453a8b76f.tar.gz
Validate User username only on Namespace, and bubble up appropriately
Diffstat (limited to 'spec/validators')
-rw-r--r--spec/validators/user_path_validator_spec.rb38
1 files changed, 0 insertions, 38 deletions
diff --git a/spec/validators/user_path_validator_spec.rb b/spec/validators/user_path_validator_spec.rb
deleted file mode 100644
index a46089cc24f..00000000000
--- a/spec/validators/user_path_validator_spec.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-require 'spec_helper'
-
-describe UserPathValidator do
- let(:validator) { described_class.new(attributes: [:username]) }
-
- describe '.valid_path?' do
- it 'handles invalid utf8' do
- expect(described_class.valid_path?("a\0weird\255path")).to be_falsey
- end
- end
-
- describe '#validates_each' do
- it 'adds a message when the path is not in the correct format' do
- user = build(:user)
-
- validator.validate_each(user, :username, "Path with spaces, and comma's!")
-
- expect(user.errors[:username]).to include(Gitlab::PathRegex.namespace_format_message)
- end
-
- it 'adds a message when the path is reserved when creating' do
- user = build(:user, username: 'help')
-
- validator.validate_each(user, :username, 'help')
-
- expect(user.errors[:username]).to include('help is a reserved name')
- end
-
- it 'adds a message when the path is reserved when updating' do
- user = create(:user)
- user.username = 'help'
-
- validator.validate_each(user, :username, 'help')
-
- expect(user.errors[:username]).to include('help is a reserved name')
- end
- end
-end