RE: Overriding rake tasks

It sounds like you want to use your own DB cloning to load up your
schema and data to avoid problems with fixtures and FK constraints.

Using my handy Rake addition, you could do something like this in your
.rake file:

clone_task = Rake::Task.lookup(:clone_structure_to_test)
clone_task.remove_prerequisite(:db_structure_dump)
clone_task.enhance(:my_custom_db_dump)

You would write the ‘my_custom_db_dump’ task to save the entire database
contents, not just the schema, to the .sql file that the
‘clone_structure_to_test’ task is looking for.

Or you could work at the next level up to replace the
‘clone_structure_to_test’ task with your own that runs a shell script to
copy one database to another.

Still not what I need, I think. Here’s what I want to do.
% ruby test/unit/my_unit_test.rb
drop database
import schema
run tests

The clone_structure_to_test is fine. What I need to do is make sure
that the database is dropped and rebuilt (schema only) before each
test suite is run. Right now Rails just deletes the records in the
db…which can cause problems when there are constraints.

Hopefully I’ve explained myself better.

Pat