PropSchema v0.1.0 PropSchema

An extension on Ecto.Schema where you can provide additional options, which will be read by the corresponding PropSchema.Executor module, used in the test files to generate property tests.

Link to this section Summary

Functions

Declares a field in the schema, processes it for use in PropSchema.Executor and then passes it through to Ecto.Schema.field/3. See prop_schema/2 for examples

Declares an Ecto.Schema with additional mechanisms that will be used under the hood to generate property tests using PropSchema.Executor

Link to this section Functions

Link to this macro prop_embedded(list) (macro)

High school english class time! prop_embedded/1 is to prop_schema/2 as Ecto.Schema.embedded_schema/1 is to Ecto.Schema.schema/2

Examples

prop_embedded do
  prop_field(:example_string, :string, string_type: :alphanumeric, required: true)
  prop_field(:example_int, :integer, postive: true, required: false)
  field(:example_float, :float)
end
Link to this macro prop_field(name, type \\ :string, opts \\ []) (macro)

Declares a field in the schema, processes it for use in PropSchema.Executor and then passes it through to Ecto.Schema.field/3. See prop_schema/2 for examples.

Link to this macro prop_schema(source, list) (macro)

Declares an Ecto.Schema with additional mechanisms that will be used under the hood to generate property tests using PropSchema.Executor.

Field Declaration

When a field is declared with prop_field/3 it will add the extra values to the additional mechanisms, but a field can just be declared with Ecto.Schema.field/3 and PropSchema.Executor will not know about it.

Examples

prop_schema "example" do
  prop_field(:example_string, :string, string_type: :alphanumeric, required: true)
  prop_field(:example_int, :integer, postive: true, required: false)
  field(:example_float, :float)
end