struct Spectator::Example::Procsy

Overview

Wraps an example to behave like a Proc. This is typically used for an around_each hook. Invoking #call or #run will run the example.

Defined in:

spectator/example.cr

Constructors

Instance Method Summary

Macro Summary

Instance methods inherited from class Object

should(matcher : Spectator::Matchers::TypeMatcher(U), message = nil, *, _file = __FILE__, _line = __LINE__) forall U
should(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

def self.new(example : Example, &proc : -> ) #

Creates the example proxy. The example should be run eventually. The proc defines the block of code to run when #call or #run is invoked.


[View source]

Instance Method Detail

def call : Nil #

Invokes the proc.


[View source]
def example : Example #

Underlying example that will run.


[View source]
def run : Nil #

Invokes the proc.


[View source]
def to_s(io : IO) : Nil #

Constructs the full name or description of the example. This prepends names of groups this example is part of.


[View source]
def wrap(&block : -> ) : self #

Creates a new procsy for a block and the example from this instance.


[View source]

Macro Detail

macro method_missing(call) #

Allow instance to behave like an example.


[View source]