module

Spectator::DSL::Examples

Inherits Spectator::DSL::Metadata

DSL methods for defining examples and test code.

Macros

define_example(name, *tags, **metadata)

Defines a macro to generate code for an example. The name is the name given to the macro.

In addition, another macro is defined that marks the example as pending. The pending macro is prefixed with 'x'. For instance, define_example :it defines it and xit.

Default tags can be provided with tags and metadata. The tags are merged with parent groups. Any items with falsey values from metadata remove the corresponding tag.

Source
define_pending_example(name, *tags, **metadata)

Defines a macro to generate code for a pending example. The name is the name given to the macro.

The block for the example's content is discarded at compilation time. This prevents issues with undefined methods, signature differences, etc.

Default tags can be provided with tags and metadata. The tags are merged with parent groups. Any items with falsey values from metadata remove the corresponding tag.

Source
example(what = nil, *tags, **metadata, &block)

Defines an example.

If a block is given, it is treated as the code to test. The block is provided the current example instance as an argument.

The first argument names the example (test). Typically, this specifies what is being tested. It has no effect on the test and is purely used for output. If omitted, a name is generated from the first assertion in the test.

The example will be marked as pending if the block is omitted. A block or name must be provided.

Tags can be specified by adding symbols (keywords) after the first argument. Key-value pairs can also be specified. Any falsey items will remove a previously defined tag.

Source
fexample(what = nil, *tags, **metadata, &block)

Defines an example.

If a block is given, it is treated as the code to test. The block is provided the current example instance as an argument.

The first argument names the example (test). Typically, this specifies what is being tested. It has no effect on the test and is purely used for output. If omitted, a name is generated from the first assertion in the test.

The example will be marked as pending if the block is omitted. A block or name must be provided.

Tags can be specified by adding symbols (keywords) after the first argument. Key-value pairs can also be specified. Any falsey items will remove a previously defined tag.

Source
fit(what = nil, *tags, **metadata, &block)

Defines an example.

If a block is given, it is treated as the code to test. The block is provided the current example instance as an argument.

The first argument names the example (test). Typically, this specifies what is being tested. It has no effect on the test and is purely used for output. If omitted, a name is generated from the first assertion in the test.

The example will be marked as pending if the block is omitted. A block or name must be provided.

Tags can be specified by adding symbols (keywords) after the first argument. Key-value pairs can also be specified. Any falsey items will remove a previously defined tag.

Source
fspecify(what = nil, *tags, **metadata, &block)

Defines an example.

If a block is given, it is treated as the code to test. The block is provided the current example instance as an argument.

The first argument names the example (test). Typically, this specifies what is being tested. It has no effect on the test and is purely used for output. If omitted, a name is generated from the first assertion in the test.

The example will be marked as pending if the block is omitted. A block or name must be provided.

Tags can be specified by adding symbols (keywords) after the first argument. Key-value pairs can also be specified. Any falsey items will remove a previously defined tag.

Source
it(what = nil, *tags, **metadata, &block)

Defines an example.

If a block is given, it is treated as the code to test. The block is provided the current example instance as an argument.

The first argument names the example (test). Typically, this specifies what is being tested. It has no effect on the test and is purely used for output. If omitted, a name is generated from the first assertion in the test.

The example will be marked as pending if the block is omitted. A block or name must be provided.

Tags can be specified by adding symbols (keywords) after the first argument. Key-value pairs can also be specified. Any falsey items will remove a previously defined tag.

Source
pending(what = nil, *tags, **metadata, &block)

Defines a pending example.

If a block is given, it is treated as the code to test. The block is provided the current example instance as an argument.

The first argument names the example (test). Typically, this specifies what is being tested. It has no effect on the test and is purely used for output. If omitted, a name is generated from the first assertion in the test.

Tags can be specified by adding symbols (keywords) after the first argument. Key-value pairs can also be specified. Any falsey items will remove a previously defined tag.

Source
skip(what = nil, *tags, **metadata, &block)

Defines a pending example.

If a block is given, it is treated as the code to test. The block is provided the current example instance as an argument.

The first argument names the example (test). Typically, this specifies what is being tested. It has no effect on the test and is purely used for output. If omitted, a name is generated from the first assertion in the test.

Tags can be specified by adding symbols (keywords) after the first argument. Key-value pairs can also be specified. Any falsey items will remove a previously defined tag.

Source
specify(what = nil, *tags, **metadata, &block)

Defines an example.

If a block is given, it is treated as the code to test. The block is provided the current example instance as an argument.

The first argument names the example (test). Typically, this specifies what is being tested. It has no effect on the test and is purely used for output. If omitted, a name is generated from the first assertion in the test.

The example will be marked as pending if the block is omitted. A block or name must be provided.

Tags can be specified by adding symbols (keywords) after the first argument. Key-value pairs can also be specified. Any falsey items will remove a previously defined tag.

Source
xexample(what = nil, *tags, **metadata, &block)

Defines a pending example.

If a block is given, it is treated as the code to test. The block is provided the current example instance as an argument.

The first argument names the example (test). Typically, this specifies what is being tested. It has no effect on the test and is purely used for output. If omitted, a name is generated from the first assertion in the test.

Tags can be specified by adding symbols (keywords) after the first argument. Key-value pairs can also be specified. Any falsey items will remove a previously defined tag.

xfexample(what = nil, *tags, **metadata, &block)

Defines a pending example.

If a block is given, it is treated as the code to test. The block is provided the current example instance as an argument.

The first argument names the example (test). Typically, this specifies what is being tested. It has no effect on the test and is purely used for output. If omitted, a name is generated from the first assertion in the test.

Tags can be specified by adding symbols (keywords) after the first argument. Key-value pairs can also be specified. Any falsey items will remove a previously defined tag.

xfit(what = nil, *tags, **metadata, &block)

Defines a pending example.

If a block is given, it is treated as the code to test. The block is provided the current example instance as an argument.

The first argument names the example (test). Typically, this specifies what is being tested. It has no effect on the test and is purely used for output. If omitted, a name is generated from the first assertion in the test.

Tags can be specified by adding symbols (keywords) after the first argument. Key-value pairs can also be specified. Any falsey items will remove a previously defined tag.

xfspecify(what = nil, *tags, **metadata, &block)

Defines a pending example.

If a block is given, it is treated as the code to test. The block is provided the current example instance as an argument.

The first argument names the example (test). Typically, this specifies what is being tested. It has no effect on the test and is purely used for output. If omitted, a name is generated from the first assertion in the test.

Tags can be specified by adding symbols (keywords) after the first argument. Key-value pairs can also be specified. Any falsey items will remove a previously defined tag.

xit(what = nil, *tags, **metadata, &block)

Defines a pending example.

If a block is given, it is treated as the code to test. The block is provided the current example instance as an argument.

The first argument names the example (test). Typically, this specifies what is being tested. It has no effect on the test and is purely used for output. If omitted, a name is generated from the first assertion in the test.

Tags can be specified by adding symbols (keywords) after the first argument. Key-value pairs can also be specified. Any falsey items will remove a previously defined tag.

xspecify(what = nil, *tags, **metadata, &block)

Defines a pending example.

If a block is given, it is treated as the code to test. The block is provided the current example instance as an argument.

The first argument names the example (test). Typically, this specifies what is being tested. It has no effect on the test and is purely used for output. If omitted, a name is generated from the first assertion in the test.

Tags can be specified by adding symbols (keywords) after the first argument. Key-value pairs can also be specified. Any falsey items will remove a previously defined tag.