fixed role name new field validators without validate fields types fixed error with user parser todo: project tests returned some tests, users fixed some more tests: filters images tests network tests keys tests test generator fixed run_list validator
19 lines
425 B
Ruby
19 lines
425 B
Ruby
require_relative "base"
|
|
module Validators
|
|
module FieldValidator
|
|
class Name < Base
|
|
|
|
MAX_NAME_LEN = 200
|
|
NAME_REGEX = /\A\w{1,#{MAX_NAME_LEN}}\z/
|
|
|
|
def valid?
|
|
!NAME_REGEX.match(@value).nil?
|
|
end
|
|
|
|
def message
|
|
"Invalid value '#{@value}': it should contains symbols 'a-zA-Z0-9_' and length should be more then 1 and less or equals then #{MAX_NAME_LEN}"
|
|
end
|
|
end
|
|
end
|
|
end
|