class Spectator::Expectations::ExpectationReporter

Overview

Tracks the expectations and their outcomes in an example. A single instance of this class should be associated with one example.

Defined in:

spectator/expectations/expectation_reporter.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(raise_on_failure : Bool = true) #

Creates the reporter. When the raise_on_failure flag is set to true, which is the default, an exception will be raised on the first failure that is reported. To store failures and continue, set the flag to false.


[View source]

Instance Method Detail

def expectations : ExampleExpectations #

Returns the reported expectations from the example. This should be run after the example has finished.


[View source]
def report(expectation : Expectation) : Nil #

Stores the outcome of an expectation. If the raise on failure flag is set to true, then this method will raise an exception when a failing result is given.


[View source]