Attesto.Test.CodeStoreDelegates (Attesto v2.28.0)

Copy Markdown View Source

Overridable Attesto.CodeStore callback delegates for test doubles.

A host can wrap a real store and override only the callbacks a test needs to observe or fault. The :to option selects the delegate target and defaults to Attesto.CodeStore.ETS; the target must be started separately.

defmodule Host.ObservedCodeStore do
  use Attesto.Test.CodeStoreDelegates, to: Attesto.CodeStore.ETS

  def claim(hash) do
    send(self(), {:claim, hash})
    super(hash)
  end
end

The generated module implements every Attesto.CodeStore callback and marks each one overridable. This helper has no ExUnit dependency.

Summary

Functions

Define overridable code-store callbacks delegating to :to (ETS by default).

Functions

__using__(opts)

(macro)

Define overridable code-store callbacks delegating to :to (ETS by default).