class Spectator::ExampleGroupBuilder

Overview

Progressively constructs an example group. Hooks and builders for child nodes can be added over time to this builder. When done, call #build to produce an ExampleGroup.

Included Modules

Direct Known Subclasses

Defined in:

spectator/example_group_builder.cr

Constructors

Instance Method Summary

Macros inherited from module Spectator::Hooks

define_hook(declaration, order = :append, &block) define_hook

Instance methods inherited from class Spectator::NodeBuilder

build(parent = nil) build

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(name : Label = nil, location : Location | Nil = nil, metadata : Metadata | Nil = nil) #

Creates the builder. Initially, the builder will have no children and no hooks. The name, location, and metadata will be applied to the ExampleGroup produced by #build.


[View source]

Instance Method Detail

def <<(builder) #

Adds a child builder to the group. The builder will have NodeBuilder#build called on it from within #build. The new example group will be passed to it.


[View source]
def after_all(hook : ExampleGroupHook) : Nil #

Registers a new "after_all" hook. The hook will be prepended to the list.


[View source]
def after_all(*args, **kwargs) : Nil #

Registers a new "after_all" hook. The hook will be prepended to the list. A new hook will be created by passing args to ExampleGroupHook.new.


[View source]
def after_all(*args, **kwargs, &block) : Nil #

Registers a new "after_all" hook. The hook will be prepended to the list. A new hook will be created by passing args to ExampleGroupHook.new.


[View source]
def after_each(hook : ExampleHook) : Nil #

Registers a new "after_each" hook. The hook will be prepended to the list.


[View source]
def after_each(*args, **kwargs) : Nil #

Registers a new "after_each" hook. The hook will be prepended to the list. A new hook will be created by passing args to ExampleHook.new.


[View source]
def after_each(*args, **kwargs, &block) : Nil #

Registers a new "after_each" hook. The hook will be prepended to the list. A new hook will be created by passing args to ExampleHook.new.


[View source]
def around_each(hook : ExampleProcsyHook) : Nil #

Registers a new "around_each" hook. The hook will be appended to the list.


[View source]
def around_each(*args, **kwargs) : Nil #

Registers a new "around_each" hook. The hook will be appended to the list. A new hook will be created by passing args to ExampleProcsyHook.new.


[View source]
def around_each(*args, **kwargs, &block) : Nil #

Registers a new "around_each" hook. The hook will be appended to the list. A new hook will be created by passing args to ExampleProcsyHook.new.


[View source]
def before_all(hook : ExampleGroupHook) : Nil #

Registers a new "before_all" hook. The hook will be appended to the list.


[View source]
def before_all(*args, **kwargs) : Nil #

Registers a new "before_all" hook. The hook will be appended to the list. A new hook will be created by passing args to ExampleGroupHook.new.


[View source]
def before_all(*args, **kwargs, &block) : Nil #

Registers a new "before_all" hook. The hook will be appended to the list. A new hook will be created by passing args to ExampleGroupHook.new.


[View source]
def before_each(hook : ExampleHook) : Nil #

Registers a new "before_each" hook. The hook will be appended to the list.


[View source]
def before_each(*args, **kwargs) : Nil #

Registers a new "before_each" hook. The hook will be appended to the list. A new hook will be created by passing args to ExampleHook.new.


[View source]
def before_each(*args, **kwargs, &block) : Nil #

Registers a new "before_each" hook. The hook will be appended to the list. A new hook will be created by passing args to ExampleHook.new.


[View source]
def build(parent = nil) #

Constructs an example group with previously defined attributes, children, and hooks. The parent is an already constructed example group to nest the new example group under. It can be nil if the new example group won't have a parent.


[View source]
def post_condition(hook : ExampleHook) : Nil #

Registers a new "post_condition" hook. The hook will be prepended to the list.


[View source]
def post_condition(*args, **kwargs) : Nil #

Registers a new "post_condition" hook. The hook will be prepended to the list. A new hook will be created by passing args to ExampleHook.new.


[View source]
def post_condition(*args, **kwargs, &block) : Nil #

Registers a new "post_condition" hook. The hook will be prepended to the list. A new hook will be created by passing args to ExampleHook.new.


[View source]
def pre_condition(hook : ExampleHook) : Nil #

Registers a new "pre_condition" hook. The hook will be appended to the list.


[View source]
def pre_condition(*args, **kwargs) : Nil #

Registers a new "pre_condition" hook. The hook will be appended to the list. A new hook will be created by passing args to ExampleHook.new.


[View source]
def pre_condition(*args, **kwargs, &block) : Nil #

Registers a new "pre_condition" hook. The hook will be appended to the list. A new hook will be created by passing args to ExampleHook.new.


[View source]