class Spectator::ExampleHooks
- Spectator::ExampleHooks
- Reference
- Object
Overview
Collection of hooks that run at various times throughout testing.
A hook is just a Proc
(code block) that runs at a specified time.
Defined in:
spectator/example_hooks.crConstructors
-
.new(before_all : Array( -> ), before_each : Array(TestMetaMethod), after_all : Array( -> ), after_each : Array(TestMetaMethod), around_each : Array(SpectatorTest, Proc(Nil) -> ))
Creates a new set of hooks.
Class Method Summary
-
.empty
Creates an empty set of hooks.
Instance Method Summary
-
#run_after_all
Runs all "after-all" hooks.
-
#run_after_each(wrapper : TestWrapper, example : Example)
Runs all "after-all" hooks.
-
#run_before_all
Runs all "before-all" hooks.
-
#run_before_each(wrapper : TestWrapper, example : Example)
Runs all "before-each" hooks.
-
#wrap_around_each(test, block : -> )
Creates a proc that runs the "around-each" hooks in addition to a block passed to this method.
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
Creates a new set of hooks.
Class Method Detail
Creates an empty set of hooks. This will effectively run nothing extra while running a test.
Instance Method Detail
Runs all "after-all" hooks. These hooks should be run once after all examples in group finish.
Runs all "after-all" hooks. These hooks should be run every time after each example in a group.
Runs all "before-all" hooks. These hooks should be run once before all examples in the group start.
Runs all "before-each" hooks. These hooks should be run every time before each example in a group.
Creates a proc that runs the "around-each" hooks
in addition to a block passed to this method.
To call the block and all "around-each" hooks,
just invoke Proc#call
on the returned proc.