Arke.Test.Sandbox (Arke v0.6.5)

Copy Markdown View Source

Per-test isolation for the manager tables.

The managers are ETS-backed and process-independent, so whatever a test registers stays visible to every later test — including in :arke_system, which tests write to as often as they write to their own project. Snapshot the bootstrapped state once, then roll back to it after each test:

# test/test_helper.exs
Arke.Test.Bootstrap.start()
Arke.Test.Sandbox.checkpoint()

# in your case template
setup do
  on_exit(&Arke.Test.Sandbox.restore/0)
end

Summary

Functions

Records the current contents of every manager as the state to roll back to.

Rolls every manager back to the last checkpoint/0 and empties the in-memory persistence store.

Functions

checkpoint()

@spec checkpoint() :: :ok

Records the current contents of every manager as the state to roll back to.

restore()

@spec restore() :: :ok

Rolls every manager back to the last checkpoint/0 and empties the in-memory persistence store.