class Athena::Validator::Spec::MockValidator
- Athena::Validator::Spec::MockValidator
- Reference
- Object
Overview
A spec implementation of AVD::Validator::ValidatorInterface
.
Allows settings the violations that should be returned. Defaults to no violations.
Included Modules
Defined in:
spec.crConstructors
Instance Method Summary
-
#in_context(context : AVD::ExecutionContextInterface) : AVD::Validator::ContextualValidatorInterface
Returns a validator in the provided context.
-
#start_context(root = nil) : AVD::Validator::ContextualValidatorInterface
Creates a new
AVD::ExecutionContextInterface
and returns a new validator for that context. -
#validate(value : _, constraints : Array(AVD::Constraint) | AVD::Constraint | Nil = nil, groups : Array(String) | String | AVD::Constraints::GroupSequence | Nil = nil) : AVD::Violation::ConstraintViolationListInterface
:inherit:
-
#validate_property(object : AVD::Validatable, property_name : String, groups : Array(String) | String | AVD::Constraints::GroupSequence | Nil = nil) : AVD::Violation::ConstraintViolationListInterface
:inherit:
-
#validate_property_value(object : AVD::Validatable, property_name : String, value : _, groups : Array(String) | String | AVD::Constraints::GroupSequence | Nil = nil) : AVD::Violation::ConstraintViolationListInterface
:inherit:
- #violations=(violations : AVD::Violation::ConstraintViolationListInterface)
Instance methods inherited from module Athena::Validator::Validator::ValidatorInterface
in_context(context : AVD::ExecutionContextInterface) : AVD::Validator::ContextualValidatorInterface
in_context,
start_context : AVD::Validator::ContextualValidatorInterface
start_context,
validate(value : _, constraints : Array(AVD::Constraint) | AVD::Constraint | Nil = nil, groups : Array(String) | String | AVD::Constraints::GroupSequence | Nil = nil) : AVD::Violation::ConstraintViolationListInterface
validate,
validate_property(object : AVD::Validatable, property_name : String, groups : Array(String) | String | AVD::Constraints::GroupSequence | Nil = nil) : AVD::Violation::ConstraintViolationListInterface
validate_property,
validate_property_value(object : AVD::Validatable, property_name : String, value : _, groups : Array(String) | String | AVD::Constraints::GroupSequence | Nil = nil) : AVD::Violation::ConstraintViolationListInterface
validate_property_value
Constructor Detail
def self.new(violations : AVD::Violation::ConstraintViolationListInterface = AVD::Violation::ConstraintViolationList.new)
#
Instance Method Detail
def in_context(context : AVD::ExecutionContextInterface) : AVD::Validator::ContextualValidatorInterface
#
Returns a validator in the provided context.
Violations generated by the returned validator are added to the provided context.
Creates a new AVD::ExecutionContextInterface
and returns a new validator for that context.
Violations generated by the returned validator can be accessed via AVD::Validator::ContextualValidatorInterface#violations
.
def validate(value : _, constraints : Array(AVD::Constraint) | AVD::Constraint | Nil = nil, groups : Array(String) | String | AVD::Constraints::GroupSequence | Nil = nil) : AVD::Violation::ConstraintViolationListInterface
#
:inherit:
def validate_property(object : AVD::Validatable, property_name : String, groups : Array(String) | String | AVD::Constraints::GroupSequence | Nil = nil) : AVD::Violation::ConstraintViolationListInterface
#
:inherit:
def validate_property_value(object : AVD::Validatable, property_name : String, value : _, groups : Array(String) | String | AVD::Constraints::GroupSequence | Nil = nil) : AVD::Violation::ConstraintViolationListInterface
#
:inherit: