module Spectator

Overview

Module that contains all functionality related to Spectator.

Extended Modules

Defined in:

spectator.cr
spectator/anything.cr
spectator/command_line_arguments_config_source.cr
spectator/composite_example_filter.cr
spectator/config.cr
spectator/config_builder.cr
spectator/config_source.cr
spectator/dsl.cr
spectator/dsl/assertions.cr
spectator/dsl/examples.cr
spectator/dsl/groups.cr
spectator/dsl/hooks.cr
spectator/dsl/matchers.cr
spectator/dsl/values.cr
spectator/errored_result.cr
spectator/example.cr
spectator/example_component.cr
spectator/example_conditions.cr
spectator/example_failed.cr
spectator/example_filter.cr
spectator/example_group.cr
spectator/example_hooks.cr
spectator/example_iterator.cr
spectator/expectation_failed.cr
spectator/expectations.cr
spectator/failed_result.cr
spectator/finished_result.cr
spectator/formatting.cr
spectator/harness.cr
spectator/line_example_filter.cr
spectator/matchers.cr
spectator/matchers/match_data.cr
spectator/mocks.cr
spectator/name_example_filter.cr
spectator/nested_example_group.cr
spectator/null_example_filter.cr
spectator/pending_example.cr
spectator/pending_result.cr
spectator/profile.cr
spectator/report.cr
spectator/result.cr
spectator/root_example_group.cr
spectator/runnable_example.cr
spectator/runner.cr
spectator/source.cr
spectator/source_example_filter.cr
spectator/spec_builder.cr
spectator/successful_result.cr
spectator/test_block.cr
spectator/test_context.cr
spectator/test_expression.cr
spectator/test_suite.cr
spectator/test_value.cr
spectator/test_values.cr
spectator/test_wrapper.cr
spectator/typed_value_wrapper.cr
spectator/value_wrapper.cr

Constant Summary

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 Method Summary

Instance Method Summary

Macro Summary

Class Method Detail

def self.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.


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


[View source]

Instance Method Detail

def configure(&) : Nil #

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.


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


[View source]

Macro Detail

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


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


[View source]