ExMachina
Create test data for Elixir applications
...For most projects (such as Phoenix apps) this will mean adding :ex_machina to the list of applications in mix.exs. You can skip this step if you are using Elixir 1.4 or later. Add your factory module inside test/support so that it is only compiled in the test environment. build/2 is a function call. As such, it gets evaluated immediately. By default, ExMachina will merge the attributes you pass into build/insert into your factory. But if you want full control of your attributes, you can define your factory as accepting one argument, the attributes being passed into your factory.