Forum: Ruby on Rails DB not being repopulated prior to Unit test execution

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Bill W. (Guest)
on 2006-02-21 21:14
(Received via mailing list)
I'm working my way through the AWD book and have just started the
testing chapter.  The first two unit tests run as expected.  When I add
the test for the 'destroy' function to product_test.rb, however, I'm
getting a failure I don't understand.

The error I'm getting says that in the setup method for test_update, it
"couldn't find Product with ID=1".  When I run product_test.rb without
the test_destroy test case, the other two methods (test_create &
test_update) find that record fine.    When I add the test_destroy case
in, though, it appears that the database isn't being cleaned and
restored before the test_update method is executed (which appears in
this case to happen after the test_destroy method).  At least, that's
the only explanation I can come up with for what's happening.

Any help understanding this will be very much appreciated.

Bill
This topic is locked and can not be replied to.