One of the reasons I prefer factories over fixtures is that my tests
express better.
login_user = Factory.create :user
login_as login_user
...
In this case, someone reading this test knows that it only matters
that a user is being created. It shouldn’t have any special
attributes.
But if I do something like this:
login_user = Factory.create :user, name: 'Rodrigo'
Then I know that the name attribute of the user is relevant for that
test.
Another reason is that I only load the records needed by my tests,
not lots of unrelated data that could have some side effect on the
tests.
Rails provides a curated stack. The stack reflects the preferences of the core team, we make some choices that we believe are the best defaults. For instance, when we compare Test::Unit and RSpec code side by side we prefer Test::Unit, and that’s what you get in the stack. Same for fixtures.
In addition to that, the framework also makes the design/development effort to let users be able to plug in alternatives, and Rails 3 made this less hackish than it was before. So it is totally fine that you prefer factories, and we’ll make sure you can use them.
Well, in the case of Rails the value of extracting something like this to a gem has more to do with the internal organization of the framework in my view.
Things in Rails follow the release cycle of Rails generally speaking. For example, Active Record is a gem, but there aren’t releases of Active Record independent from Rails, albeit it can be used outside Rails.
I don’t see a need to extract fixtures to a gem personally.