struct Athena::Validator::Spec::ConstraintValidatorTestCase::Assertion

Overview

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.

Defined in:

spec/constraint_validator_test_case.cr

Constructors

Instance Method Summary

Constructor Detail

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

[View source]

Instance Method Detail

def 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]
def 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]
def at_path(property_path : String) : self #

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

Returns self for chaining.


[View source]
def cause(cause : String?) : self #

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

Returns self for chaining.


[View source]
def clone #

[View source]
def code(code : String?) : self #

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

Returns self for chaining.


[View source]
def constraint : AVD::Constraint #


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

[View source]
def invalid_value(value : _) : self #

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

Returns self for chaining.


[View source]
def message : String #

def plural(plural : Int32) : self #

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

Returns self for chaining.


[View source]