class Spectator::DSL::NestedExampleGroupBuilder

Overview

Standard example group builder. Creates groups of examples and nested groups.

Direct Known Subclasses

Defined in:

spectator/dsl/nested_example_group_builder.cr

Constructors

Instance Method Summary

Instance methods inherited from class Spectator::DSL::ExampleGroupBuilder

add_after_all_hook(block : -> ) : Nil add_after_all_hook, add_after_each_hook(block : -> ) : Nil add_after_each_hook, add_around_each_hook(block : Proc(Nil) -> ) : Nil add_around_each_hook, add_before_all_hook(block : -> ) : Nil add_before_all_hook, add_before_each_hook(block : -> ) : Nil add_before_each_hook, add_child(child : Child) add_child, add_post_condition(block : -> ) : Nil add_post_condition, add_pre_condition(block : -> ) : Nil add_pre_condition

Instance methods inherited from class Object

should(matcher : Spectator::Matchers::Matcher) should, should_not(matcher : Spectator::Matchers::Matcher) should_not

Constructor Detail

def self.new(what : Symbol | String) #

Creates a new group builder. The value for what should be the context for the group.

For example, in these samples:

describe String do
  # ...
  context "with an empty string" do
    # ...
  end
end

The value would be "String" for the describe block and "with an empty string" for the context block. Use a Symbol when referencing a type name.


[View source]

Instance Method Detail

def build(parent : ExampleGroup, sample_values : Internals::SampleValues) : NestedExampleGroup #

Builds the example group. A new NestedExampleGroup will be returned which can have instances of Example and ExampleGroup nested in it. The parent should be the group that contains this group. The sample_values will be given to all of the examples (and groups) nested in this group.


[View source]