View Source SchemaAssertions (Schema Assertions v0.1.3)
ExUnit assertions for Ecto schemas.
examples
Examples
iex> import SchemaAssertions
iex> alias SchemaAssertions.Test.Schema
...>
iex> assert_schema Schema.House, "houses",
...> address: :text,
...> id: :bigserial
...>
iex> assert_schema Schema.House, "houses",
...> address: :text,
...> id: :id
Link to this section Summary
Functions
Asserts that the given schema module has a belongs_to association.
Asserts that the given schema module has a has_many or has_many :through association.
Asserts that the given schema module exists and that its corresponding database table exists.
Link to this section Functions
Specs
Asserts that the given schema module has a belongs_to association.
example
Example
iex> alias SchemaAssertions.Test.Schema
iex> SchemaAssertions.assert_belongs_to(Schema.Room, :house, Schema.House)
true
Link to this function
assert_has_many(schema_module, association, association_module_or_opts)
View SourceSpecs
Asserts that the given schema module has a has_many or has_many :through association.
example
Example
iex> alias SchemaAssertions.Test.Schema
iex> SchemaAssertions.assert_has_many(Schema.House, :rooms, Schema.Room)
true
iex> alias SchemaAssertions.Test.Schema
iex> SchemaAssertions.assert_has_many(Schema.House, :windows, through: [:rooms, :windows])
true
Specs
Asserts that the given schema module exists and that its corresponding database table exists.