class Spectator::ExampleGroup

Overview

Collection of examples and sub-groups.

Included Modules

Direct Known Subclasses

Defined in:

spectator/example_group.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::Node

display_name display_name, finished? : Bool finished?, inspect(io : IO) : Nil inspect, location : Location location, location? : Location | Nil location?, metadata : Metadata metadata, name : Label name, name? : Label | Nil name?, pending? pending?, pending_reason pending_reason, tags tags, to_s(io : IO) : Nil to_s

Constructor methods inherited from class Spectator::Node

new(name : Label = nil, location : Location | Nil = nil, metadata : Metadata | Nil = nil) new

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, group : ExampleGroup | Nil = nil, metadata : Metadata | Nil = nil) #

Creates the example group. The name describes the purpose of the group. It can be a Symbol to describe a type. The location tracks where the group exists in source code. This group will be assigned to the parent group if it is provided. A set of metadata can be used for filtering and modifying example behavior.


[View source]

Instance Method Detail

def <<(node : Node) #

Adds the specified node to the group. Assigns the node to this group. If the node already belongs to a group, it will be removed from the previous group before adding it to this group.


[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 ascend(&) #

Yields this group and all parent groups.


[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 delete(node : Node) #

Removes the specified node from the group. The node will be unassigned from this group.


[View source]
def finished? : Bool #

Checks if all examples and sub-groups have finished.


[View source]
def group : ExampleGroup #

Parent group this group belongs to.


[View source]
def group? : ExampleGroup | Nil #

Parent group this group belongs to.


[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]
def size(*args, **options) #

[View source]
def size(*args, **options, &) #

[View source]
def to_s(io : IO, *, nested = false) : Nil #

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


[View source]
def unsafe_fetch(*args, **options) #

[View source]
def unsafe_fetch(*args, **options, &) #

[View source]