abstract class Spectator::Result

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.cr

Constructors

Instance Method Summary

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

def self.new(example : Spectator::Example) #

Constructs the base of the result. The example should refer to the example that was run and that this result is for.


[View source]

Instance Method Detail

abstract def call(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.


[View source]
abstract def call(interface, &block : Result -> _) #

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.


[View source]
def example : Example #

Example that was run that this result is for.


[View source]
def to_json(json : JSON::Builder) #

Creates a JSON object from the result information.


[View source]