Factory Girl: Continued DataMapper Compatibility
Saturday
Oct 24, 2009
10:44 pm
The factory_girl Gem is a great tool for creating valid test instances on the fly. There are lots of posts about why this is so much better then fixtures. Unfortunately for us DataMapper fans, the official version is not quite compatible with our favorite ORM. I've done my best to remedy that situation. There is now a fork of factory_girl that I have made mostly compatible with both DataMapper and ActiveRecord. You can also pull the gem from GemCutter as dm-factory_girl.
It is my full intention to maintain this fork for at least the next 12 months or until it becomes part of an official release, however programming is not my source of income, and if major changes happen during Christmas or Holy Week, they probably will not be merged quickly. I would love some help keeping up with the standard release.
There are two pieces that are not working in an optimal fashion. First factory_girl/syntax/* must be required before models are defined to work properly. Second, Stubs are not guaranteed to avoid he database. The DataMapper API is different enough that the hack that stubs ActiveRecord will not work correctly. Stubs will most likely require a DataMapper specific rewrite
Finally a big thank you to Blake Gentry who got a lot of the syntax pieces (generate, make, blueprint) that I don't to work with DataMapper, and to Ben Orenstein whose documentation patch is included in this version as well.