Assertion
struct Athena::Validator::Spec::ConstraintValidatorTestCase::Assertion
inherits Struct
Used to assert that a violation added via the AVD::ConstraintValidatorInterface
was built as expected.
NOTE: This type should not be instantiated directly, use AVD::Spec::ConstraintValidatorTestCase#build_violation
instead.
Class methods
.new(context : AVD::ExecutionContextInterface, message : String, constraint : AVD::Constraint)
(context : AVD::ExecutionContextInterface, message : String, constraint : AVD::Constraint)
Methods
#add_parameter(key : String, value : _) : self
(key : String, value : _) : self
Adds the provided key value pair to the expected violations' AVD::Violation::ConstraintViolationInterface#parameters
.
Returns self
for chaining.
#assert_violation(*, file : String = __FILE__, line : Int32 = __LINE__) : Nil
(*, file : String = __FILE__, line : Int32 = __LINE__) : Nil
Asserts that the violation added to the context equals the violation built via self
.
#at_path(property_path : String) : self
(property_path : String) : self
Sets the AVD::Violation::ConstraintViolationInterface#property_path
on the expected violation.
Returns self
for chaining.
#cause(cause : String?) : self
(cause : String?) : self
Sets the AVD::Violation::ConstraintViolationInterface#cause
on the expected violation.
Returns self
for chaining.
#clone
#code(code : String?) : self
(code : String?) : self
Sets the AVD::Violation::ConstraintViolationInterface#code
on the expected violation.
Returns self
for chaining.
#constraint : AVD::Constraint
: AVD::Constraint
#context : AVD::ExecutionContextInterface
: AVD::ExecutionContextInterface
#copy_with(context _context = @context, message _message = @message, constraint _constraint = @constraint)
(context _context = @context, message _message = @message, constraint _constraint = @constraint)
#invalid_value(value : _) : self
(value : _) : self
Sets the AVD::Violation::ConstraintViolationInterface#invalid_value
on the expected violation.
Returns self
for chaining.
#message : String
: String
#plural(plural : Int32) : self
(plural : Int32) : self
Sets the AVD::Violation::ConstraintViolationInterface#plural
on the expected violation.
Returns self
for chaining.