[rspec-users] how to avoid tests removing data that my migrations put in?
pergesu at gmail.com
Tue Nov 4 18:05:13 EST 2008
"Greg Hauptmann" <greg.hauptmann.ruby at gmail.com> writes:
> I have an issue in that I have some reference data my migrations run
> in. However when running "rake spec" it seems to remove the data in
> the test database up front.
> What do you recommend to workaround this issue?
> rspec-users mailing list
> rspec-users at rubyforge.org
You should probably create it in a before block, or if the reference
data is always going to be the same, you'll want to insert it into the
db BEFORE the test transactions start. That will require a bit of
work...clear out all the tables and insert the data, that way when
transactions get rolled back you're back at the db with reference data.
I'm not quite sure how to do that though. Is there a before(:suite)
that might work?
More information about the rspec-users