struct Spectator::TestValues

Overview

Collection of test values supplied to examples. Each value is labeled by a symbol that the example knows. The values also come with a name that can be given to humans.

Included Modules

Defined in:

spectator/test_values.cr

Class Method Summary

Instance Method Summary

Instance methods inherited from class Object

should(matcher) should, should_eventually(matcher) should_eventually, should_never(matcher) should_never, should_not(matcher) should_not

Class Method Detail

def self.empty #

Creates an empty set of sample values.


[View source]

Instance Method Detail

def add(id : Symbol, name : String, value) : TestValues #

Adds a new value by duplicating the current set and adding to it. The new sample values with the additional value is returned. The original set of sample values is not modified.


[View source]
def each(&) #

Iterates over all values and yields them.


[View source]
def get_value(id : Symbol, value_type : T.class) : T forall T #

Retrieves a value. The symbol for the value is used for retrieval. The value's type must be provided so that the wrapper can be cast.


[View source]
def get_wrapper(id : Symbol) #

Retrieves the wrapper for a value. The symbol for the value is used for retrieval.


[View source]