class

SpectatorContext

Inherits Reference / Object

Base class that all test cases run in. This type is used to store all test case contexts as a single type. The instance must be downcast to the correct type before calling a context method. This type is intentionally outside the Spectator module. The reason for this is to prevent name collision when using the DSL to define a spec.

Instance methods

eval

Evaluates the contents of a block within the scope of the context.

Source
inspect(io : IO) : Nil

Produces a dummy string to represent the context as a string. This prevents the default behavior, which normally stringifies instance variables. Due to the sheer amount of types Spectator can create and that the Crystal compiler instantiates a #to_s and/or #inspect for each of those types, an explosion in method instances can be created. The compile time is drastically reduced by using a dummy string instead.

Source
to_s(io : IO) : Nil

Produces a dummy string to represent the context as a string. This prevents the default behavior, which normally stringifies instance variables. Due to the sheer amount of types Spectator can create and that the Crystal compiler instantiates a #to_s and/or #inspect for each of those types, an explosion in method instances can be created. The compile time is drastically reduced by using a dummy string instead.

Source