module Spectator::DSL::Memoize

Overview

DSL methods for defining test values (subjects). These values are stored and reused throughout the test.

Direct including types

Defined in:

spectator/dsl/memoize.cr

Macro Summary

Macro Detail

macro let(name, &block) #

Defines a memoized getter. The name is the name of the getter method. The block is evaluated only on the first time the getter is used and the return value is saved for subsequent calls.


[View source]
macro let!(name, &block) #

Defines a memoized getter. The name is the name of the getter method. The block is evaluated once before the example runs and the return value is saved.


[View source]
macro subject(&block) #

Explicitly defines the subject of the tests. Creates a memoized getter for the subject. The block is evaluated only the first time the subject is referenced and the return value is saved for subsequent calls.


[View source]
macro subject(name, &block) #

Explicitly defines the subject of the tests. Creates a memoized getter for the subject. The subject can be referenced by using subject or name. The block is evaluated only the first time the subject is referenced and the return value is saved for subsequent calls.


[View source]
macro subject!(&block) #

Explicitly defines the subject of the tests. Creates a memoized getter for the subject. The block is evaluated once before the example runs and the return value is saved for subsequent calls.


[View source]
macro subject!(name, &block) #

Explicitly defines the subject of the tests. Creates a memoized getter for the subject. The subject can be referenced by using subject or name. The block is evaluated once before the example runs and the return value is saved for subsequent calls.


[View source]