class Spectator::ExampleGroup
Overview
Collection of examples and sub-groups.
Included Modules
- Indexable(Spectator::Node)
- Spectator::Hooks
Direct Known Subclasses
Defined in:
spectator/example_group.crConstructors
-
.new(name : Label = nil, location : Location | Nil = nil, group : ExampleGroup | Nil = nil, metadata : Metadata | Nil = nil)
Creates the example group.
Instance Method Summary
-
#<<(node : Node)
Adds the specified node to the group.
-
#after_all(hook : ExampleGroupHook) : Nil
Registers a new "after_all" hook.
-
#after_all(*args, **kwargs) : Nil
Registers a new "after_all" hook.
-
#after_all(*args, **kwargs, &block) : Nil
Registers a new "after_all" hook.
-
#after_each(hook : ExampleHook) : Nil
Registers a new "after_each" hook.
-
#after_each(*args, **kwargs) : Nil
Registers a new "after_each" hook.
-
#after_each(*args, **kwargs, &block) : Nil
Registers a new "after_each" hook.
-
#around_each(hook : ExampleProcsyHook) : Nil
Registers a new "around_each" hook.
-
#around_each(*args, **kwargs) : Nil
Registers a new "around_each" hook.
-
#around_each(*args, **kwargs, &block) : Nil
Registers a new "around_each" hook.
-
#ascend(&)
Yields this group and all parent groups.
-
#before_all(hook : ExampleGroupHook) : Nil
Registers a new "before_all" hook.
-
#before_all(*args, **kwargs) : Nil
Registers a new "before_all" hook.
-
#before_all(*args, **kwargs, &block) : Nil
Registers a new "before_all" hook.
-
#before_each(hook : ExampleHook) : Nil
Registers a new "before_each" hook.
-
#before_each(*args, **kwargs) : Nil
Registers a new "before_each" hook.
-
#before_each(*args, **kwargs, &block) : Nil
Registers a new "before_each" hook.
-
#delete(node : Node)
Removes the specified node from the group.
-
#finished? : Bool
Checks if all examples and sub-groups have finished.
-
#group : ExampleGroup
Parent group this group belongs to.
-
#group? : ExampleGroup | Nil
Parent group this group belongs to.
-
#post_condition(hook : ExampleHook) : Nil
Registers a new "post_condition" hook.
-
#post_condition(*args, **kwargs) : Nil
Registers a new "post_condition" hook.
-
#post_condition(*args, **kwargs, &block) : Nil
Registers a new "post_condition" hook.
-
#pre_condition(hook : ExampleHook) : Nil
Registers a new "pre_condition" hook.
-
#pre_condition(*args, **kwargs) : Nil
Registers a new "pre_condition" hook.
-
#pre_condition(*args, **kwargs, &block) : Nil
Registers a new "pre_condition" hook.
- #size(*args, **options)
- #size(*args, **options, &)
-
#to_s(io : IO, *, nested = false) : Nil
Constructs the full name or description of the example group.
- #unsafe_fetch(*args, **options)
- #unsafe_fetch(*args, **options, &)
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 Ushould(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
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.
Instance Method Detail
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.
Registers a new "after_all" hook. The hook will be prepended to the list.
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
.
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
.
Registers a new "after_each" hook. The hook will be prepended to the list.
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
.
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
.
Registers a new "around_each" hook. The hook will be appended to the list.
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
.
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
.
Registers a new "before_all" hook. The hook will be appended to the list.
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
.
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
.
Registers a new "before_each" hook. The hook will be appended to the list.
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
.
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
.
Removes the specified node from the group. The node will be unassigned from this group.
Registers a new "post_condition" hook. The hook will be prepended to the list.
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
.
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
.
Registers a new "pre_condition" hook. The hook will be appended to the list.
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
.
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
.
Constructs the full name or description of the example group. This prepends names of groups this group is part of.