class Spectator::ExampleBuilder

Overview

Constructs examples. Call #build to produce an Example.

Defined in:

spectator/example_builder.cr

Constructors

Instance Method Summary

Instance methods inherited from class Spectator::NodeBuilder

build(parent = nil) build

Instance methods inherited from class Object

should(matcher, message = nil) should, should_eventually(matcher, message = nil) should_eventually, should_never(matcher, message = nil) should_never, should_not(matcher, message = nil) should_not

Constructor Detail

def self.new(context_builder : -> Context, entrypoint : Example -> , name : String? = nil, location : Location? = nil, metadata : Metadata = Metadata.new) #

Creates the builder. A proc provided by context_builder is used to create a unique Context for each example produced by #build. The entrypoint indicates the proc used to invoke the test code in the example. The name, location, and metadata will be applied to the Example produced by #build.


[View source]

Instance Method Detail

def build(parent = nil) #

Constructs an example with previously defined attributes and context. The parent is an already constructed example group to nest the new example under. It can be nil if the new example won't have a parent.


[View source]