class Spectator::NestedExampleGroup
Overview
A collection of examples and other example groups. This group can be nested under other groups.
Defined in:
spectator/nested_example_group.crConstructors
-
.new(what : String | Symbol, parent : Spectator::ExampleGroup, hooks : ExampleHooks, conditions : ExampleConditions)
Creates a new example group.
Instance Method Summary
-
#parent : ExampleGroup
Group that this is nested in.
-
#run_post_conditions : Nil
Runs all of the post-condition checks.
-
#run_pre_conditions : Nil
Runs all of the pre-condition checks.
-
#symbolic? : Bool
Indicates wheter the group references a type.
-
#to_s(io)
Creates a string representation of the group.
-
#what : Symbol | String
Description from the user of the group's contents.
-
#wrap_around_each_hooks(&block : -> ) : ->
Creates a proc that runs the "around-each" hooks in addition to a block passed to this method.
Instance methods inherited from class Spectator::ExampleGroup
[](index : Int) : Example
[],
children : Array(ExampleComponent)
children,
children=(children : Array(ExampleComponent))
children=,
children? : Array(ExampleComponent) | Nil
children?,
each(&)each : Iterator(ExampleComponent) each, example_count : Int example_count, finished? : Bool finished?, run_after_hooks run_after_hooks, run_before_hooks run_before_hooks, run_post_conditions run_post_conditions, run_pre_conditions run_pre_conditions, wrap_around_each_hooks(&block : -> ) : -> wrap_around_each_hooks
Constructor methods inherited from class Spectator::ExampleGroup
new(hooks : ExampleHooks, conditions : ExampleConditions)
new
Instance methods inherited from class Spectator::ExampleComponent
[](index : Int) : Example
[],
example_count : Int
example_count,
finished? : Bool
finished?,
symbolic? : Bool
symbolic?,
what : Symbol | String
what
Instance methods inherited from class Object
should(matcher : Spectator::Matchers::Matcher)
should,
should_not(matcher : Spectator::Matchers::Matcher)
should_not
Constructor Detail
Creates a new example group. The what argument is a description from the user. The parent should contain this group. After creating this group, the parent's children should be updated. The parent's children must contain this group, otherwise there may be unexpected behavior. The hooks are stored to be triggered later.
Instance Method Detail
Runs all of the post-condition checks. This method should run following every example in the group. Parent post-conditions will be checked last.
Runs all of the pre-condition checks. This method should run prior to every example in the group. Parent pre-conditions will be checked first.
Creates a string representation of the group.
The string consists of #what
appended to the parent.
This results in a string like:
Foo#bar does something
for the following structure:
describe Foo do
describe "#bar" do
it "does something" do
# ...
end
end
end
Description from the user of the group's contents. This is a symbol when referencing a type.
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.
Parent "around-each" hooks will be in the outermost wrappings.