abstract class Spectator::Result
- Spectator::Result
- Reference
- Object
Overview
Base class that represents the outcome of running an example. Sub-classes contain additional information specific to the type of result.
Direct Known Subclasses
Defined in:
spectator/result.crConstructors
-
.new(example : Spectator::Example)
Constructs the base of the result.
Instance Method Summary
-
#call(interface)
Calls the corresponding method for the type of result.
-
#call(interface, &block : Result -> _)
Calls the corresponding method for the type of result.
-
#example : Example
Example that was run that this result is for.
-
#to_json(json : JSON::Builder)
Creates a JSON object from the result information.
Instance methods inherited from class Object
should(matcher)
should,
should_eventually(matcher)
should_eventually,
should_never(matcher)
should_never,
should_not(matcher)
should_not
Constructor Detail
Constructs the base of the result. The example should refer to the example that was run and that this result is for.
Instance Method Detail
Calls the corresponding method for the type of result. This is used to avoid placing if or case-statements everywhere based on type. Each sub-class implements this method by calling the correct method on interface.
Calls the corresponding method for the type of result. This is used to avoid placing if or case-statements everywhere based on type. Each sub-class implements this method by calling the correct method on interface. This variation takes a block, which is passed the result. The value returned from the block will be returned by this method.