ExUnit-style assertions for Accrue's append-only event ledger.
Usage
use Accrue.Test.EventAssertions
# or
import Accrue.Test.EventAssertions
assert_event_recorded(
type: "subscription.created",
subject: subscription,
subject_type: "Subscription",
subject_id: subscription.id,
actor_type: "system",
data: %{"status" => "active"},
matches: fn event -> event.schema_version == 1 end
)Matching
:typematchesevent.type:subjectderivessubject_typeandsubject_idfrom a struct or map with:id:subject_type,:subject_id, and:actor_typematch the event fields directly:datasubset-matches only the provided keys:matchesruns a 1-arity predicate against%Accrue.Events.Event{}
Assertions query the test process' database sandbox state. Failure messages include the matcher and observed event type/subject summaries, but avoid dumping raw event payload data.
Summary
Functions
Asserts that an event matching matcher was recorded.
Asserts that an event matching subject and matchers was recorded.
Asserts that no event matching matcher was recorded.
Refutes that an event matching matcher was recorded.
Refutes that an event matching subject and matchers was recorded.
Functions
Asserts that an event matching matcher was recorded.
Asserts that an event matching subject and matchers was recorded.
Asserts that no event matching matcher was recorded.
Refutes that an event matching matcher was recorded.
Refutes that an event matching subject and matchers was recorded.