Bill Walton
2006-Feb-21 19:12 UTC
[Rails] DB not being repopulated prior to Unit test execution
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 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060221/1c89b11c/attachment-0001.html
Seemingly Similar Threads
- problema con i test automatizzati
- Testing model: test becomes dependent on previous test
- How to write unit tests with respect to model callbacks?
- [PATCH server] fixed functional tests after recent controller refactoring and managed node controller fixes.
- Setting up Testing model, getting an error