I’m working on a hack to preload fixtures, and decided that
test_helper.rb was the best place to do this. I define a method and
then call it right away.
In brief, this method runs rake/shell tasks using Â´Â´ (bad approach, I
know… - suggestions?), i.e.:
dump my dev db ddl
load the test db with all ddl except FKs
rake db:fixtures:load RAILS_ENV=test
load the FKs
However, step #2 fails, as the purge task for postgres works by
dropping and recreating the db, which can’t be done while there’s an
open connection to it.
I’ve tried calling ActiveRecord::Base.connection.disconnect! right
before running the purge task, to no avail. I figure the connection
may not even be using AR…
Anyone familiar enough with the workings here to give some advice?
This is all very fragile and platform dependant anyway, so path of
least resistance is preferred, don’t worry about cleanliness… –
The various plugins for specifying fixture load order are not an
Thanks in advance,