ex_machina v2.1.0 ExMachina.Sequence View Source

Module for generating sequential values.

Use ExMachina.sequence/1 or ExMachina.sequence/2 to generate sequential values instead of calling this module directly.

Link to this section Summary

Functions

Reset all sequences so that the next sequence starts from 0

Link to this section Functions

Reset all sequences so that the next sequence starts from 0

Example

ExMachina.Sequence.next("joe") # "joe0"
ExMachina.Sequence.next("joe") # "joe1"

ExMachina.Sequence.reset

ExMachina.Sequence.next("joe") # resets so the return value is "joe0"

If you want to reset sequences at the beginning of every test, put it in a setup block in your test.

setup do
  ExMachina.Sequence.reset
end