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.cr

Constructors

Instance Method Summary

Instance methods inherited from class Spectator::ExampleGroup

[](index : Int) : Example [], children : Array(ExampleComponent) children, children=(children : Array(ExampleComponent)) children=, children? : Array(ExampleComponent) | Nil children?, context : Spectator::TestContext context, double(id, sample_values) double, each(&)
each : Iterator(ExampleComponent)
each
, example_count : Int example_count, finished? : Bool finished?

Constructor methods inherited from class Spectator::ExampleGroup

new(context : TestContext) new

Instance methods inherited from class Spectator::ExampleComponent

[](index : Int) : Example [], description : Symbol | String description, example_count : Int example_count, finished? : Bool finished?, full_description full_description, source : Source source, symbolic? : Bool symbolic?

Instance methods inherited from class Object

should(matcher) should, should_eventually(matcher) should_eventually, should_never(matcher) should_never, should_not(matcher) should_not

Constructor Detail

def self.new(description : String | Symbol, source : Spectator::Source, parent : Spectator::ExampleGroup, context) #

Creates a new example group. The description 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.


[View source]

Instance Method Detail

def description : Symbol | String #

Description from the user of the group's contents. This is a symbol when referencing a type.


[View source]
def parent : ExampleGroup #

Group that this is nested in.


[View source]
def source : Source #

[View source]
def symbolic? : Bool #

Indicates wheter the group references a type.


[View source]
def to_s(io) #

Creates a string representation of the group. The string consists of #description 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

[View source]