[rspec-users] how to avoid tests removing data that my migrations put in?

Mark Wilden mark at mwilden.com
Wed Nov 5 14:30:24 EST 2008


I'll just point out one more disadvantage of assuming the contents of the
test database are correct (without 'rake db:test:prepare'). If you interrupt
a test with Ctrl-C (especially when running autospec), it's possible for the
transaction not to get rolled back. An uncommitted transaction should get
rolled back automatically, but I've seen that fail to happen, at least with
PostgreSQL 8.1. A test would assume that a given table is empty, they'd add
a row, expect the count to be 1, and it would fail because of existing
cruft. I eventually learned to run 'rake spec' when weird failures happened.
Just something to keep in mind.

///ark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20081105/51ae0706/attachment.html>


More information about the rspec-users mailing list