View Source SeedFactory.Test (SeedFactory v0.2.0)
A helper module for ExUnit
.
usage
Usage
Add the following line to your test modules:
use SeedFactory.Test, schema: MySeedFactorySchema
It sets up SeedFactory
by invoking SeedFactory.init/2
and imports SeedFactory.rebind/3
, SeedFactory.produce/2
, SeedFactory.exec/3
and SeedFactory.exec/2
functions.
Link to this section Summary
Functions
A macro that implicitly passes context
and allows using SeedFactory.produce/2
outside the test
block.
Link to this section Functions
A macro that implicitly passes context
and allows using SeedFactory.produce/2
outside the test
block.
Basically, it creates a setup
block and calls SeedFactory.produce/2
inside.
examples
Examples
produce :company
test "my test", company: company do
assert my_function(company)
end
produce [:user, :project]
test "my test", user: user, project: project do
assert my_function(project, user)
end
produce org: :org1
produce org: :org2
test "my test", org1: org1, org2: org2 do
assert my_function(org2, org1)
end