module Spectator::DSL::Hooks

Overview

DSL methods for adding custom logic to key times of the spec execution.

Direct including types

Defined in:

spectator/dsl/hooks.cr

Macro Summary

Macro Detail

macro after(&block) #

Defines a block of code that will be invoked after every example in the group. The block will be run in the context of the current running example. This means that values defined by let and subject are available.


[View source]
macro after_all(&block) #

Defines a block of code that will be invoked once after all examples in the group. The block will not run in the context of the current running example. This means that values defined by let and subject are not available.


[View source]
macro after_each(&block) #

Defines a block of code that will be invoked after every example in the group. The block will be run in the context of the current running example. This means that values defined by let and subject are available.


[View source]
macro after_suite(&block) #

Defines a block of code that will be invoked once after all examples in the suite. The block will not run in the context of the current running example. This means that values defined by let and subject are not available.


[View source]
macro around(&block) #

Defines a block of code that will be invoked around every example in the group. The block will be run in the context of the current running example. This means that values defined by let and subject are available.

The block will execute before the example. An Example::Procsy is passed to the block. The Example::Procsy#run method should be called to ensure the example runs. More code can run afterwards (in the block).


[View source]
macro around_each(&block) #

Defines a block of code that will be invoked around every example in the group. The block will be run in the context of the current running example. This means that values defined by let and subject are available.

The block will execute before the example. An Example::Procsy is passed to the block. The Example::Procsy#run method should be called to ensure the example runs. More code can run afterwards (in the block).


[View source]
macro before(&block) #

Defines a block of code that will be invoked before every example in the group. The block will be run in the context of the current running example. This means that values defined by let and subject are available.


[View source]
macro before_all(&block) #

Defines a block of code that will be invoked once before any examples in the group. The block will not run in the context of the current running example. This means that values defined by let and subject are not available.


[View source]
macro before_each(&block) #

Defines a block of code that will be invoked before every example in the group. The block will be run in the context of the current running example. This means that values defined by let and subject are available.


[View source]
macro before_suite(&block) #

Defines a block of code that will be invoked once before any examples in the suite. The block will not run in the context of the current running example. This means that values defined by let and subject are not available.


[View source]
macro define_example_group_hook(type, name = nil, &block) #

Defines a macro to create an example group hook. The type indicates when the hook runs and must be a method on Spectator::DSL::Builder. A custom name can be used for the hook method. If not provided, type will be used instead. Additionally, a block can be provided. The block can perform any operations necessary and yield to invoke the end-user hook.


[View source]
macro define_example_hook(type, name = nil, &block) #

Defines a macro to create an example hook. The type indicates when the hook runs and must be a method on Spectator::DSL::Builder. A custom name can be used for the hook method. If not provided, type will be used instead. Additionally, a block can be provided that takes the current example as an argument. The block can perform any operations necessary and yield to invoke the end-user hook.


[View source]
macro post_condition(&block) #

Defines a block of code that will be invoked after every example in the group. The block will be run in the context of the current running example. This means that values defined by let and subject are available.


[View source]
macro pre_condition(&block) #

Defines a block of code that will be invoked before every example in the group. The block will be run in the context of the current running example. This means that values defined by let and subject are available.


[View source]