View Source Doumi.Test.Assertions (Doumi.Test v0.1.4)
Summary
Functions
Assert that two maps have the same value for a given fields. The two maps must always contain the given field.
Assert that two records have the same primary keys.
Assert that two values are the same.
Functions
Assert that two maps have the same value for a given fields. The two maps must always contain the given field.
Examples
iex> assert_same_fields %{a: 1, b: 2}, %{a: 1, b: 2}, [:a, :b]
true
iex> assert_same_fields %{a: 1, b: 2}, %{a: 1, b: 3}, [:a, :b]
** (ExUnit.AssertionError)
The two maps have different values for the given fields
Assert that two records have the same primary keys.
Examples
iex> assert_same_records %TestModule1{id: 1}, %TestModule1{id: 1}
true
iex> assert_same_records %TestModule1{id: 1}, %TestModule1{id: 2}
** (ExUnit.AssertionError)
The two records have different primary keys
Assert that two values are the same.
Examples
iex> assert_same_values 1, 1
true
iex> assert_same_values 1, 2
** (ExUnit.AssertionError)
`1` and `2` are not the same values