ISTR that "destroy_all" will instantiate each object, before destroying it. If you just want to clean the database, I think "delete_all" is the one you want (it just does a "delete from [table]", if memory serves), and should be a lot quicker.
David 2008/12/6 Mark Wilden <[EMAIL PROTECTED]>: > On Fri, Dec 5, 2008 at 6:32 AM, Jeff Talbot <[EMAIL PROTECTED]> wrote: >> >> There is a seemingly very useful line of code in the cucumber wiki >> that I'd like to use: >> >> After do >> # Scenario teardown >> Database.truncate_all >> end > > That's just an example of some code you might call in an After. A little > lower, you see > > TempFileManager.clean_up > > which also looks like non-Rails/Cucumber code. > > A simple way to achieve the former would be > > class Database > def self.truncate > TheModel.destroy_all > TheOtherModel.destroy_all > # etc > end > end > > destroy_all isn't exactly the same as SQL TRUNCATE, but it might serve your > purpose. > > ///ark > > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users