Class: Dragnet::Validators::Fields::IDValidator
- Inherits:
-
FieldValidator
- Object
- FieldValidator
- Dragnet::Validators::Fields::IDValidator
- Defined in:
- lib/dragnet/validators/fields/id_validator.rb
Overview
Validates the ID Field for Manual Test Records
Instance Method Summary collapse
-
#validate(key, value) ⇒ Object
Validates the Requirement ID(s) of the MTR.
Instance Method Details
#validate(key, value) ⇒ Object
Validates the Requirement ID(s) of the MTR
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/dragnet/validators/fields/id_validator.rb', line 17 def validate(key, value) validate_presence(key, value) validate_type(key, value, String, Array) if value.is_a?(String) match = value.match(/,|\s/) return unless match validation_error( "Disallowed character '#{match}' found in the value for key #{key}. "\ 'To use multiple requirement IDs please put them into an array' ) else validate_array_types(key, value, String) end end |