class

Spectator::Example

Inherits Spectator::ExampleComponent < Reference < Object

Base class for all types of examples. Concrete types must implement the #run_impl method.

Constructors

new(group : Spectator::ExampleGroup, test_wrapper : Spectator::TestWrapper)

Creates the base of the example. The group should be the example group the example belongs to.

Source

Instance methods

[](index : Int) : Example

Retrieve the current example.

Source
description

Text that describes the context or test.

Source
example_count

Indicates there is only one example to run.

Source
finished?

Indicates whether the example has already been run.

Source
group

Group that the example belongs to.

Source
run

Runs the example code. A result is returned, which represents the outcome of the test. An example can be run only once. An exception is raised if an attempt is made to run it more than once.

Source
run_impl
Source
source

Source where the example originated from.

Source
symbolic?

Indicates that the component references a type or method.

Source
to_json(json : JSON::Builder)

Creates the JSON representation of the example, which is just its name.

Source
to_s(io)

String representation of the example. This consists of the groups the example is in and the description. The string can be given to end-users to identify the example.

Source