SchemaAssertions.ChangesetAssertions (Schema Assertions v2.0.1)

View Source

Assertions for changeset validity.

Summary

Functions

Assert that a changeset's fields match the expected values. The field values are obtained via Ecto.Changeset.fetch_field!/2 and are the values from either the changes or the data.

Assert that a changeset is invalid, including asserting on all of its validation errors

Assert that a changeset is valid

Functions

assert_changeset_fields(changeset, fields)

Assert that a changeset's fields match the expected values. The field values are obtained via Ecto.Changeset.fetch_field!/2 and are the values from either the changes or the data.

assert_changeset_invalid(tuple_or_changeset, expected_errors \\ nil)

Assert that a changeset is invalid, including asserting on all of its validation errors

Example: assert_changeset_invalid(changeset, start_date: ["please enter dates as mm/dd/yyyy"])

assert_changeset_valid(changeset)

Assert that a changeset is valid

Example: assert_changeset_valid(changeset)