Ben Mabey <[EMAIL PROTECTED]> writes: > Aslak Hellesøy wrote: >> >> >> Sent from my iPhone >> >> On 5. nov.. 2008, at 00.05, Pat Maddox <[EMAIL PROTECTED]> wrote: >> >>> "Greg Hauptmann" <[EMAIL PROTECTED]> writes: >>> >>>> hi, >>>> >>>> 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? >>>> >>>> Thanks >>>> Greg >>>> _______________________________________________ >>>> rspec-users mailing list >>>> [email protected] >>>> http://rubyforge.org/mailman/listinfo/rspec-users >>> >>> 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? >>> >> >> There is no need for a special construct. Just do it at the top >> level in env.rb or an adjacent file. Use at_exit for a global >> "teardown". > > I believe they are talking about rspec examples and not cucumber features...
aslak's right though in that case too. In your spec_helper, just loop over the tables and delete everything, then insert the seed data you want, and it should be good to go. Pat _______________________________________________ rspec-users mailing list [email protected] http://rubyforge.org/mailman/listinfo/rspec-users
