module Spectator::DSL::Builder

Overview

Incrementally builds up a test spec from the DSL. This is intended to be used only by the Spectator DSL.

Extended Modules

Defined in:

spectator/dsl/builder.cr

Instance Method Summary

Instance Method Detail

def add_example(*args, &block : Example -> ) #

Defines a new example. The example is added to the group currently on the top of the stack.

See Spec::Builder#add_example for usage details.


[View source]
def add_pending_example(*args) #

Defines a new pending example. The example is added to the group currently on the top of the stack.

See Spec::Builder#add_pending_example for usage details.


[View source]
def after_all(location = nil, label = "after_all", &block) #

Defines a block of code to execute after any and all examples in the current group.


[View source]
def after_each(location = nil, label = "after_each", &block : Example -> ) #

Defines a block of code to execute after every example in the current group.


[View source]
def after_suite(location = nil, label = "after_suite", &block) #

Defines a block of code to execute after any and all examples in the test suite.


[View source]
def around_each(location = nil, label = "around_each", &block : Example::Procsy -> ) #

Defines a block of code to execute around every example in the current group.


[View source]
def before_all(location = nil, label = "before_all", &block) #

Defines a block of code to execute before any and all examples in the current group.


[View source]
def before_each(location = nil, label = "before_each", &block : Example -> _) #

Defines a block of code to execute before every example in the current group


[View source]
def before_suite(location = nil, label = "before_suite", &block) #

Defines a block of code to execute before any and all examples in the test suite.


[View source]
def build : Spec #

Constructs the test spec. Returns the spec instance.

Raises an error if there were not symmetrical calls to #start_group and #end_group. This would indicate a logical error somewhere in Spectator or an extension of it.


[View source]
def end_group(*args) #

Completes a previously defined example group and pops it off the group stack. Be sure to call #start_group and #end_group symmetrically.

See Spec::Builder#end_group for usage details.


[View source]
def post_condition(location = nil, label = "post_condition", &block : Example -> ) #

Defines a block of code to execute after every example in the current group.


[View source]
def pre_condition(location = nil, label = "pre_condition", &block : Example -> _) #

Defines a block of code to execute before every example in the current group


[View source]
def start_group(*args) #

Defines a new example group and pushes it onto the group stack. Examples and groups defined after calling this method will be nested under the new group. The group will be finished and popped off the stack when #end_example is called.

See Spec::Builder#start_group for usage details.


[View source]
def start_iterative_group(*args) #

Defines a new iterative example group and pushes it onto the group stack. Examples and groups defined after calling this method will be nested under the new group. The group will be finished and popped off the stack when #end_example is called.

See Spec::Builder#start_iterative_group for usage details.


[View source]