I've recently extracted a plugin that significantly improves (well, I
hope) fixtures. I'd originally written it as a backwards-compatible
patch, but I'd like to get some comments on the approach before I
shove it into Trac.
I tossed it out on #rails-contrib, and bitsweat thought it might
benefit from a larger audience. Major benefits include constant
generated ID's, specification of belongs_to/has_one associations by
label, and the total obliteration of HABTM join table fixtures. Kindly
pile on the comments.
"Fixture bashing is a popular hobby, and I'm especially indebted to
Courtenay/caboo.se's Awesome Fixtures, which originally talked me
down off of the "no more fixtures, ever!" ledge."
Absolutely, and it would be really easy to support a DEFAULTS key
internally instead of letting YAML do it. I originally avoided
supporting the defaults internally to keep the code from bloating, but
that might be a lame reason.
I still think the syntax is a little wet... When you're just specifying
lists of things (like, apples, oranges and grapes):
I see what you're going for, but I actually haven't run in to the need
for something like that: If it's a simple list that you're rarely
going to be adding properties to, why not write it out in expanded
form the one time and be done? OTOH, if you find yourself adding *any*
properties to the list entries, you're going to want them in expanded
form anyways.
I'm trying to keep Rathole's changes as minimal as possible: I think
keeping things very focused will increase the chances of getting this
(or something like it) folded back into Rails proper.
It should be pretty darn easy for you to write a plugin that provides
the features you're looking for, though.