View Source Given.Step behaviour (given_exunit v1.22.196)
Behaviour that documents the return values of a Given, When or Then step.
Summary
Types
ExUnit test case context
Return of each step has the following effect on the context
Tuple representing the parsed clause
Types
@type context() :: map()
ExUnit test case context
Return of each step has the following effect on the context:
- empty list - no effect
- :error - fail with a RuntimeError
- - fail with a RuntimeError
- false - fail with a RuntimeError
- list of atoms - remove the given keys from the context
- keyword list - put the items into the context
- other - ignored and context is not changed
- true - context is not changed
@type step() :: tuple()
Tuple representing the parsed clause
Callbacks
Setup the state of the world.
Normally returns a keyword list of one or more values to be appended to the context for future steps.
Note the trailing underscore to be consistent with when_
.
Run assertions on the context.
Normally would not change the context so return an empty list.
Note the trailing underscore to be consistent with when_
.
Execute the behaviour.
Normally returns a keyword list of one or more values to be appended to the context for future steps.
when
is a reserved keyword in Elixir and so we use when_
.