Spectator::Example
Inherits Spectator::Node / Reference / Object
Standard example that runs a test case.
Constructors
Creates the example. An instance to run the test code in is given by context. The entrypoint defines the test code (typically inside context). The name describes the purpose of the example. The location tracks where the example exists in source code. The example will be assigned to group if it is provided. A set of metadata can be used for filtering and modifying example behavior. Note: The metadata will not be merged with the parent metadata.
Creates the example. An instance to run the test code in is given by context. The entrypoint defines the test code (typically inside context). The name describes the purpose of the example. It can be a proc to be evaluated in the context of the example. The location tracks where the example exists in source code. The example will be assigned to group if it is provided. A set of metadata can be used for filtering and modifying example behavior. Note: The metadata will not be merged with the parent metadata.
Creates a dynamic example.
A block provided to this method will be called as-if it were the test code for the example.
The block will be given this example instance as an argument.
The name describes the purpose of the example.
It can be a Symbol to describe a type.
The location tracks where the example exists in source code.
The example will be assigned to group if it is provided.
A set of metadata can be used for filtering and modifying example behavior.
Note: The metadata will not be merged with the parent metadata.
Class methods
Creates a pending example.
The name describes the purpose of the example.
It can be a Symbol to describe a type.
The location tracks where the example exists in source code.
The example will be assigned to group if it is provided.
A set of metadata can be used for filtering and modifying example behavior.
Note: The metadata will not be merged with the parent metadata.
Instance methods
Executes the test case.
Returns the result of the execution.
The result will also be stored in #result.
Creates the JSON representation of the example, which is just its name.
Constructs the full name or description of the example. This prepends names of groups this example is part of.