class Spectator::FailResult
Overview
Outcome that indicates an example failed. This typically means an assertion did not pass.
Direct Known Subclasses
Defined in:
spectator/fail_result.crConstructors
-
.new(elapsed, error : Exception, expectations = [] of Expectation)
Creates a failure result.
Instance Method Summary
-
#accept(visitor)
Calls the
failure
method on visitor. -
#accept(visitor, &)
Calls the
failure
method on visitor. -
#error : Exception
Error that occurred while running the example.
-
#fail? : Bool
Indicates whether the example failed.
-
#location : Location
Attempts to retrieve the location where the example failed.
-
#location? : Location | Nil
Attempts to retrieve the location where the example failed.
-
#pass? : Bool
Indicates whether the example passed.
-
#to_json(json : JSON::Builder)
Creates a JSON object from the result information.
-
#to_s(io : IO) : Nil
One-word description of the result.
Instance methods inherited from class Spectator::Result
accept(visitor)
accept,
elapsed : Time::Span
elapsed,
expectations : Enumerable(Expectation)
expectations,
fail? : Bool
fail?,
pass? : Bool
pass?,
pending? : Bool
pending?,
to_json(json : JSON::Builder)
to_json
Constructor methods inherited from class Spectator::Result
new(elapsed : Time::Span, expectations : Enumerable(Spectator::Expectation) = [] of Expectation)
new
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 a failure result. The elapsed argument is the length of time it took to run the example. The error is the exception raised that caused the failure.
Instance Method Detail
Error that occurred while running the example. This describes the primary reason for the failure.
Attempts to retrieve the location where the example failed.
This only works if the location of the failed expectation was reported.
If available, returns a Location
, otherwise raises NilAssertionError
.
Attempts to retrieve the location where the example failed.
This only works if the location of the failed expectation was reported.
If available, returns a Location
, otherwise nil
.