Skip to content

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)

Methods

#add_parameter(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

Asserts that the violation added to the context equals the violation built via self.

#at_path(property_path : String) : self

Sets the AVD::Violation::ConstraintViolationInterface#property_path on the expected violation.

Returns self for chaining.

#cause(cause : String?) : self

Sets the AVD::Violation::ConstraintViolationInterface#cause on the expected violation.

Returns self for chaining.

#clone

#code(code : String?) : self

Sets the AVD::Violation::ConstraintViolationInterface#code on the expected violation.

Returns self for chaining.

#constraint : AVD::Constraint

#copy_with(context _context = @context, message _message = @message, constraint _constraint = @constraint)

#invalid_value(value : _) : self

Sets the AVD::Violation::ConstraintViolationInterface#invalid_value on the expected violation.

Returns self for chaining.

#message : String

#plural(plural : Int32) : self

Sets the AVD::Violation::ConstraintViolationInterface#plural on the expected violation.

Returns self for chaining.