struct Spectator::Expectation::Target(T)
- Spectator::Expectation::Target(T)
- Struct
- Value
- Object
Overview
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.
Defined in:
spectator/expectation.crConstructors
-
.new(expression : Expression(T), location : Location)
Creates the expectation target.
Instance Method Summary
-
#never_to(stub : Stub, message = nil) : Nil
Asserts that a method is not called before the example completes.
-
#never_to(matcher, message = nil) : Nil
Asserts that some criteria defined by the matcher is never satisfied.
-
#not_to(stub : Stub, message = nil) : Nil
Asserts that a method is not called before the example completes.
-
#not_to(matcher, message = nil) : Nil
Asserts that some criteria defined by the matcher is not satisfied.
-
#to(matcher : Matchers::TypeMatcher(U), message = nil) forall U
Asserts that some criteria defined by the matcher is satisfied.
-
#to(stub : Stub, message = nil) : Nil
Asserts that a method is called some point before the example completes.
-
#to(matcher, message = nil) : Nil
Asserts that some criteria defined by the matcher is satisfied.
-
#to_eventually(stub : Stub, message = nil) : Nil
Asserts that a method is called some point before the example completes.
-
#to_eventually(matcher, message = nil) : Nil
Asserts that some criteria defined by the matcher is eventually satisfied.
-
#to_never(stub : Stub, message = nil) : Nil
Asserts that a method is not called before the example completes.
-
#to_never(matcher, message = nil) : Nil
Asserts that some criteria defined by the matcher is never satisfied.
-
#to_not(matcher : Matchers::TypeMatcher(U), message = nil) forall U
Asserts that some criteria defined by the matcher is not satisfied.
-
#to_not(stub : Stub, message = nil) : Nil
Asserts that a method is not called before the example completes.
-
#to_not(matcher : Matchers::NilMatcher, message = nil)
Asserts that some criteria defined by the matcher is not satisfied.
-
#to_not(matcher, message = nil) : Nil
Asserts that some criteria defined by the matcher is not satisfied.
Instance methods inherited from class Object
should(matcher : Spectator::Matchers::TypeMatcher(U), message = nil, *, _file = __FILE__, _line = __LINE__) forall Ushould(matcher, message = nil, *, _file = __FILE__, _line = __LINE__) should, should_eventually(matcher, message = nil, *, _file = __FILE__, _line = __LINE__) should_eventually, should_never(matcher, message = nil, *, _file = __FILE__, _line = __LINE__) should_never, should_not(matcher : Spectator::Matchers::TypeMatcher(U), message = nil, *, _file = __FILE__, _line = __LINE__) forall U
should_not(matcher : Spectator::Matchers::NilMatcher, message = nil, *, _file = __FILE__, _line = __LINE__)
should_not(matcher, message = nil, *, _file = __FILE__, _line = __LINE__) should_not
Constructor Detail
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.
Instance Method Detail
Asserts that a method is not called before the example completes.
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.
Asserts that a method is not called before the example completes.
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.
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.
Asserts that a method is called some point before the example completes.
Asserts that some criteria defined by the matcher is satisfied. Allows a custom message to be used.
Asserts that a method is called some point before the example completes.
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.
Asserts that a method is not called before the example completes.
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.
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.
Asserts that a method is not called before the example completes.
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.