[rspec-users] Database.truncate_all

Ben Mabey ben at benmabey.com
Sat Dec 6 12:28:34 EST 2008


Jeff Talbot 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
>
> (from http://github.com/aslakhellesoy/cucumber/wikis/migration-from-rspec-stories)
>
> But when I run this I get an uninitialized constant error for "Database".
>
> Anybody know if/how I can make this call? Is there something I need to
> require? Is there a different way of doing this now? I have a need to
> not use transactional_fixtures for a specific suite of tests and I
> want to clear out the database after every run so my tests are
> isolated.
>
> Thanks,
> Jeff
>   

As pointed out this was just an example.  For ideas on how to implement 
such a method you can read this previous thread about it:
http://www.mail-archive.com/rspec-users@rubyforge.org/msg06597.html

-Ben


More information about the rspec-users mailing list