fixture_dependencies is a plugin that changes the way Rails uses
fixtures in
the following ways:
- Fixtures can specify associations instead of foreign keys
- Supports belongs_to, has_many, has_one, and habtm associations
- Loads a fixture’s dependencies (associations with other fixtures)
before the
fixture itself so that foreign key constraints aren’t violated - Can specify individual fixtures to load per test or test suite
- Loads fixtures on every test inside a transaction, so fixture
information
is never left in your database - Handles almost all cyclic dependencies
To use, first install the plugin, then add the following to
test/test_helper.rb after “require ‘test_help’”:
require ‘fixture_dependencies_test_help’
This overrides the default test helper to load the fixtures inside
transactions
and to use FixtureDependencies to load the fixtures.
fixture_dependencies is available via http and svn:
svn: svn://code.jeremyevans.net/rails-plugins/fixture_dependencies
file: http://code.jeremyevans.net/code/fixture_dependencies.tar.gz
RDoc for the plugin is available at:
http://code.jeremyevans.net/doc/fixture_dependencies/
Enjoy,
Jeremy