Skip to content

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.

Constructors#

.new(context : AVD::ExecutionContextInterface, message : String, constraint : AVD::Constraint)#

View source

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.

View source

#assert_violation(*, file : String = __FILE__, line : Int32 = __LINE__) : Nil#

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

View source

#at_path(property_path : String) : self#

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

Returns self for chaining.

View source

#cause(cause : String | Nil) : self#

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

Returns self for chaining.

View source

#clone#

View source

#code(code : String | Nil) : self#

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

Returns self for chaining.

View source

#constraint : AVD::Constraint#

#context : AVD::ExecutionContextInterface#

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

View source

#invalid_value(value : _) : self#

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

Returns self for chaining.

View source

#message : String#

#plural(plural : Int32) : self#

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

Returns self for chaining.

View source