Ecto Flow Assertions

September 15, 2020 · View on GitHub

This is a library of assertions for code that works with Ecto schemas or changesets. It is built on top of FlowAssertions. It is used to write tests in this style:

VM.ServiceGap.accept_form(…)
|> ok_content(Changeset)

|> assert_valid
|> assert_changes(id: 1,
                  in_service_datestring: @iso_date_1,
                  out_of_service_datestring: @iso_date_2,
                  reason: "reason")

See the documentation for more.

Installation

Add ecto_flow_assertions to your list of dependencies in mix.exs:

def deps do
  [
    {:ecto_flow_assertions, "~> 0.1", only: :test},
  ]
end