struct

Spectator::Expectation::Target(T)

Inherits Struct / Value / Object

Stores part of an expectation. This covers the actual value (or block) being inspected and its location. This is the type returned by an expect block in the DSL. It is not intended to be used directly, but instead by chaining methods. Typically #to and #not_to are used.

Constructors

new(expression : Expression(T), location : Location)

Creates the expectation target. The expression is the actual value being tested and its label. The location is the location of where this expectation was defined.

Source

Instance methods

never_to(stub : Stub, message = nil) : Nil

Asserts that a method is not called before the example completes.

Source
never_to(matcher, message = nil) : Nil

Asserts that some criteria defined by the matcher is never satisfied. The expectation is checked after the example finishes and all hooks have run. Allows a custom message to be used.

Source
not_to(stub : Stub, message = nil) : Nil

Asserts that a method is not called before the example completes.

Source
not_to(matcher, message = nil) : Nil

Asserts that some criteria defined by the matcher is not satisfied. Allows a custom message to be used. Returns the expected value cast as a non-nillable type, if the matcher is satisfied.

Source
to(matcher : Matchers::TypeMatcher(U), message = nil) forall U

Asserts that some criteria defined by the matcher is satisfied. Allows a custom message to be used. Returns the expected value cast as the expected type, if the matcher is satisfied.

Source
to(stub : Stub, message = nil) : Nil

Asserts that a method is called some point before the example completes.

Source
to(matcher, message = nil) : Nil

Asserts that some criteria defined by the matcher is satisfied. Allows a custom message to be used.

Source
to_eventually(stub : Stub, message = nil) : Nil

Asserts that a method is called some point before the example completes.

Source
to_eventually(matcher, message = nil) : Nil

Asserts that some criteria defined by the matcher is eventually satisfied. The expectation is checked after the example finishes and all hooks have run. Allows a custom message to be used.

Source
to_never(stub : Stub, message = nil) : Nil

Asserts that a method is not called before the example completes.

Source
to_never(matcher, message = nil) : Nil

Asserts that some criteria defined by the matcher is never satisfied. The expectation is checked after the example finishes and all hooks have run. Allows a custom message to be used.

Source
to_not(matcher : Matchers::TypeMatcher(U), message = nil) forall U

Asserts that some criteria defined by the matcher is not satisfied. Allows a custom message to be used. Returns the expected value cast without the unexpected type, if the matcher is satisfied.

Source
to_not(stub : Stub, message = nil) : Nil

Asserts that a method is not called before the example completes.

Source
to_not(matcher : Matchers::NilMatcher, message = nil)

Asserts that some criteria defined by the matcher is not satisfied. Allows a custom message to be used. Returns the expected value cast as a non-nillable type, if the matcher is satisfied.

Source
to_not(matcher, message = nil) : Nil

Asserts that some criteria defined by the matcher is not satisfied. This is effectively the opposite of #to. Allows a custom message to be used.

Source