module Spectator::DSL::Examples

Overview

DSL methods for defining examples and test code.

Included Modules

Direct including types

Defined in:

spectator/dsl/examples.cr

Macro Summary

Macro Detail

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


[View source]
macro 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.


[View source]
macro 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.


[View source]
macro 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.


[View source]
macro 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.


[View source]
macro 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.


[View source]
macro 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.


[View source]
macro 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.

DEPRECATED Behavior of pending blocks will change in Spectator v0.11.0. Use skip instead.


[View source]
macro 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.


[View source]
macro 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.


[View source]
macro 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.


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


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


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


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


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