On Thu, Mar 20, 2008 at 4:02 AM, Rick DeNatale <[EMAIL PROTECTED]> wrote: > On 3/20/08, Tero Tilus <[EMAIL PROTECTED]> wrote: > > On Wed, 19 Mar 2008, Joe Van Dyk wrote: > > > do I have to manually clear out the database after a story runs? > > > > > > I'm wondering the same, but with specs. Database gets dirty and > > tests start to fail when i repeatedly do rake spec. > > >From what I've seen, the test infrastructure (which RSpec takes from > the Rails Test::Unit based code) relies on fixtures to initialize the > database BEFORE running tests. > > The setup code clears any tables for which fixtures are declared, then > loads those fixtures. > > It's a little counterintuitive that the tables don't get cleared AFTER > the test, but I guess it makes sense in that without clearing before > loading those tables wouldn't be in a known state at the beginning of > the test. > > What I've done is to have fixtures with a single record for tables I > want to 'clear'. Alternatively you can do something like: > > MyModel.delete_all > > For any tables you want to clear, in the before block for tests, or in > the xxx_story.rb for stories.
Seems like the tables should get cleared before and after the tests? _______________________________________________ rspec-users mailing list [email protected] http://rubyforge.org/mailman/listinfo/rspec-users
