module

Spectator::SpecBuilder

Global builder used to create the runtime instance of the spec. The DSL methods call into this module to generate parts of the spec. Once the DSL is done, the #build method can be invoked to create the entire spec as a runtime instance.

Instance methods

add_after_all_hook

Adds a block of code to run after all examples in the current group.

Source
add_after_each_hook

Adds a block of code to run after each example in the current group.

Source
add_around_each_hook

Adds a block of code to run before and after each example in the current group. The block of code will be given another hook as an argument. It is expected that the block will call the hook.

Source
add_before_all_hook

Adds a block of code to run before all examples in the current group.

Source
add_before_each_hook

Adds a block of code to run before each example in the current group.

Source
add_default_stub(*args) : Nil
Source
add_example(description : String | Nil, source : Source, example_type : ::SpectatorTest.class, &runner : SpectatorTest -> ) : Nil

Adds an example type to the current group. The class name of the example should be passed as an argument. The example will be instantiated later.

Source
add_pending_example(description : String | Nil, source : Source, example_type : ::SpectatorTest.class, &runner : SpectatorTest -> ) : Nil

Adds an example type to the current group. The class name of the example should be passed as an argument. The example will be instantiated later.

Source
add_post_condition

Adds a post-condition to run at the end of every example in the current group.

Source
add_pre_condition

Adds a pre-condition to run at the start of every example in the current group.

Source
end_group

Marks the end of a group in the spec. This must be called for every #start_group and #start_sample_group call. It is also important to line up the start and end calls. Otherwise examples might get placed into wrong groups.

Source
start_group(*args) : Nil

Begins a new nested group in the spec. A corresponding #end_group call must be made when the group being started is finished. See NestedExampleGroupBuilder#initialize for the arguments as arguments to this method are passed directly to it.

Source
start_sample_group(*args, &block : TestValues -> Array(T)) : Nil forall T

Begins a new sample group in the spec - that is, a group defined by the StructureDSL#sample macro in the DSL. A corresponding #end_group call must be made when the group being started is finished. See SampleExampleGroupBuilder#initialize for the arguments as arguments to this method are passed directly to it.

Source

Nested types