PropSchema v0.1.1 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
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
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
prop_embedded([{:do, PropSchema.Types.ast_expression()}]) :: PropSchema.Types.ast_expression()
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
prop_field(atom(), atom(), keyword()) :: PropSchema.Types.ast_expression()
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.
prop_schema(String.t(), [{:do, PropSchema.Types.ast_expression()}]) :: PropSchema.Types.ast_expression()
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