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
.
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, list2) | let! evaluate block like |
let(var, keep_quoted \\ true, list3) | 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’ |
subject(var) | Defines ‘subject’ |
subject(var, list2) | Defines ‘subject’ with name. It is just an alias for ‘let’ |
Functions
Specs:
- __struct__ :: %ESpec.Let{function: term, keep_quoted: term, var: term}
Struct keeps the name of variable and random function name.
Get stored value.
Store value.
Starts Agent to save state of ‘lets’.
Macros
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.
let! evaluate block like before
Defines ‘subject’.
Defines ‘subject’ with name. It is just an alias for ‘let’.