
Why I don't like factory_girl - michaelfairley
http://blog.steveklabnik.com/posts/2012-07-14-why-i-don-t-like-factory_girl
======
ryanbraganza
I'm not seeing much of an argument against factory_girl (in unit tests) other
than: it's not as fast as setting up your model by hand. And no description of
the alternative?

~~~
jameskilton
The alternative is to stop building so many dependencies between your models
so you don't need a tool like factory_girl at all! No fixtures, no factories,
make only and exactly what you need for each test. If that test setup is
getting untenable, that's test pain! Yay! Now refactor your code and fix the
pain properly by reducing coupling.

The problem with factory_girl is that it lets you __hide __this pain instead
of fix it, letting you get on with building massively coupled systems that
turn into maintenance nightmares.

As a side note your unit tests should _never_ hit the database or any external
service. Your unit test suite should finish in at most a few seconds. If it's
slower than that you have problems.

