ESpec.Let

Defines ‘let’, ‘let!’ and ‘subject’ macrsos. ‘let’ and ‘let!’ macros define named functions with cached return values. The ‘let’ evaluate block in runtime when called first time. The ‘let!’ evaluates as a before block just after all ‘befores’ for example. The ‘subject’ macro is just an alias for let to define subject.

Source

Summary

__struct__()

Struct keeps the name of variable and random function name

agent_get(key)

Get stored value

agent_put(key, value)

Store value

let!(var, list)

let! evaluate block like before

let(var, keep_quoted \\ true, list)

The macro defines funtion with random name which returns block value. That function will be called when example is run. The function will place the block value to the Agent dict

start_agent()

Starts Agent to save state of ‘lets’

stop_agent()

Stops Agent

subject!(var)

Defines ‘subject!’

subject!(var, list)

Defines ‘subject!’ with name. It is just an alias for ‘let!’

subject(var)

Defines ‘subject’

subject(var, list)

Defines ‘subject’ with name. It is just an alias for ‘let’

Functions

__struct__()

Struct keeps the name of variable and random function name.

Source
agent_get(key)

Get stored value.

Source
agent_put(key, value)

Store value.

Source
start_agent()

Starts Agent to save state of ‘lets’.

Source
stop_agent()

Stops Agent

Source

Macros

let(var, keep_quoted \\ true, list)

The macro defines funtion with random name which returns block value. That function will be called when example is run. The function will place the block value to the Agent dict.

Source
let!(var, list)

let! evaluate block like before

Source
subject(var)

Defines ‘subject’.

Source
subject(var, list)

Defines ‘subject’ with name. It is just an alias for ‘let’.

Source
subject!(var)

Defines ‘subject!’.

Source
subject!(var, list)

Defines ‘subject!’ with name. It is just an alias for ‘let!’.

Source