-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add insert, insert_pair and insert_list to ExMachina.Ecto, and ExMachina.Strategy #102
Conversation
The extra information was there for people upgrading from ExMachina 0.4.0. Now that we're getting ready for 1.0 this can be removed.
@@ -5,7 +5,7 @@ defmodule ExMachina do | |||
In depth examples are in the [README](README.html) | |||
""" | |||
|
|||
defmodule UndefinedFactory do | |||
defmodule UndefinedFactoryError do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is Elixir convention to add Error
to all errors
ddc8837
to
a61e062
Compare
|
||
# Add `except: [build: 2] to the `Ecto.Model` import | ||
import Ecto.Model, except: [build: 2] | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ecto changed the function to Ecto.build_assoc
so this no longer applies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
I'll fix the error on Circle sometime this week. @jsteiner any other comments? |
```elixir | ||
defmodule MyApp.Factory do | ||
use ExMachina.Ecto, repo: MyApp.Repo | ||
defmodule MyApp.JsonFactory do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just call this MyApp.Factory
? I think the JsonFactory
calls itself out a little too much. Took me a couple seconds to realize it wasn't actually doing any magic and it's irrelevant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea!
Nice! I had a few small comments, but otherwise I think this is a really elegant solution. Great work @paulcsmith! |
Thanks for the review @jsteiner! I'm glad you like the new direction. I'll resolve the comments and get this in on Friday :) |
d8c8d6f
to
fb4c696
Compare
These tests are no longer necessary since this is part of Ecto and is tested there.
fb4c696
to
86a8c92
Compare
This is totally overhauled from what we were originally going to do. Instead base ExMachina will only add
build
functions. You can useExMachina.Strategy
to define more functions. ExMachina.Ecto uses this under the hood to addinsert
functions to factories.This PR also removes a bunch of old stuff we're no longer using
Closes #89