module

Spectator

Module that contains all functionality related to Spectator.

Constants

CONFIG_FILE_PATH = ".spectator"

Path to the Spectator configuration file. The contents of this file should contain command-line arguments. Those arguments are automatically applied when Spectator starts. Arguments should be placed with one per line.

VERSION = "0.9.31"

Current version of the Spectator library.

Class methods

autorun=(autorun)

Flag indicating whether Spectator should automatically run tests. This should be left alone (set to true) in typical usage. There are times when Spectator shouldn't run tests. One of those is testing Spectator.

Source
autorun?

Flag indicating whether Spectator should automatically run tests. This should be left alone (set to true) in typical usage. There are times when Spectator shouldn't run tests. One of those is testing Spectator.

Source

Instance methods

configure

Provides a means to configure how Spectator will run and report tests. A ConfigBuilder is yielded to allow changing the configuration. NOTE: The configuration set here can be overriden with a .spectator file and command-line arguments.

Source
random

Random number generator for the test suite. All randomly generated values should be pulled from this. This provides reproducable results even though random values are used. The seed for this random generator is controlled by ConfigBuilder.seed=.

Source

Macros

context(description, &block)

Top-level describe method. All specs in a file must be wrapped in this call. This takes an argument and a block. The argument is what your spec is describing. It can be any Crystal expression, but is typically a class name or feature string. The block should contain all of the specs for what is being described. Example:

Spectator.describe Foo do
  # Your specs for `Foo` go here.
end

NOTE: Inside the block, the Spectator prefix is no longer needed. Actually, prefixing methods and macros with Spectator most likely won't work and can cause compiler errors.

Source
describe(description, &block)

Top-level describe method. All specs in a file must be wrapped in this call. This takes an argument and a block. The argument is what your spec is describing. It can be any Crystal expression, but is typically a class name or feature string. The block should contain all of the specs for what is being described. Example:

Spectator.describe Foo do
  # Your specs for `Foo` go here.
end

NOTE: Inside the block, the Spectator prefix is no longer needed. Actually, prefixing methods and macros with Spectator most likely won't work and can cause compiler errors.

Source

Nested types