Foxify Fixtures plugin for Rails(See original blog post: http://edgenic.com/2008/06/11/foxify-fixtures-plugin-refactor-those-old-fixtures-to-make-them-foxy)
Foxify fixtures refactors your Rails application test fixtures by changing all id-based references to name-based references (see http://ryandaigle.com/articles/2007/10/26/what-s-new-in-edge-rails-fixtures-just-got-a-whole-lot-easier). It should work on both regular Test fixtures as well as Rspec fixtures.
The plugin assumes that various conventions are followed, for instance:
all foreign keys end with 'id' class names are the "camelized", singular form of the table names Given these assumptions, Foxify fixtures may not work if your models and relationships deviate from the default Rails way of doing things.
One caveat: This plugin only "foxifies" the actual fixture .yml files themselves. If your tests access the fixtures based on ID's, those will have to be manually refactored to access the fixtures based on names.
UsageAlthough the plugin will try to back up your fixtures into a directory named 'backup' where your fixtures are located, it's a good idea to back up your app before running the plugin.
Run as follows:
TroubleshootingFoxify fixtures relies upon the associations an app has defined in it's models. If an association is missing, for example having a 'has_many :books' association in your Author model, but missing the respective 'belongs_to :author' in your Book model, the you'll get an error message telling you what foreign key is missing the association. It's also possible that the plugin will incorrectly complain about your associations, if they don't follow the default Rails conventions.
Copyright (c) 2008 Bruz Marzolf, released under the MIT license
These details are provided for information only. No information here is legal advice and should not be used as such.