The conformance case for a repo. use Mediate.Conformance.RepoCase, repo: MyApp.Repo writes the tests that hold the repo to the seam. The
repo must answer __mediate__/1. It must export nothing outside the
surface of the build it comes from. It must refuse, before any SQL,
every query, write, and raw call on a protected schema that carries no
decision and no exemption.
The test starts the repo. The protected schema's table need not exist.
defmodule MyApp.RepoTest do
use Mediate.Conformance.RepoCase, repo: MyApp.Repo
endAn adopter that names a Mediate.Conformance.RepoCase.Rows module as
well gets five more tests, one per guarantee in guarantees/0. Those
five write to the database the rows module names.
defmodule MyApp.RepoTest do
use Mediate.Conformance.RepoCase, repo: MyApp.Repo, rows: MyApp.RepoRows
end
Summary
Functions
E3: a write the seam never saw publishes nothing, and the write reaches the row.
E2: every bulk call the repo exports raises on an audited schema, and none of them publishes.
Runs the assertion of one guarantee, by its id, against the repo and the rows module.
E4: the handler's own write is in the transaction the write opened, so a rollback takes it too.
E1: one event for the insert, one for the update, with the fact fields the update changed.
E5: a get under a decision is one access event that names the row, the
decision, and the subject. An exists? is one that names no row. A read
under an exemption is none.
Calls the function with fixture arguments on the protected schema and expects the refusal.
Fails unless the repo answers __mediate__/1 and exports only classified functions.
The guarantee table under "The guarantees" in
the conformance document as
data, one id and one sentence per row. The freeze test in mediate holds
it to the document row for row.
The rows module's own setup, where it defines one.
The query, write, and raw functions the repo exports, each swept with fixture arguments.
Functions
E3: a write the seam never saw publishes nothing, and the write reaches the row.
E2: every bulk call the repo exports raises on an audited schema, and none of them publishes.
Runs the assertion of one guarantee, by its id, against the repo and the rows module.
E4: the handler's own write is in the transaction the write opened, so a rollback takes it too.
E1: one event for the insert, one for the update, with the fact fields the update changed.
E5: a get under a decision is one access event that names the row, the
decision, and the subject. An exists? is one that names no row. A read
under an exemption is none.
@spec assert_refused(module(), {atom(), non_neg_integer()}) :: :ok
Calls the function with fixture arguments on the protected schema and expects the refusal.
@spec assert_surface(module()) :: :ok
Fails unless the repo answers __mediate__/1 and exports only classified functions.
The guarantee table under "The guarantees" in
the conformance document as
data, one id and one sentence per row. The freeze test in mediate holds
it to the document row for row.
The rows module's own setup, where it defines one.
@spec swept(module()) :: [{atom(), non_neg_integer()}]
The query, write, and raw functions the repo exports, each swept with fixture arguments.