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

Pat Maddox pergesu at gmail.com
Wed Nov 5 14:45:38 EST 2008

"Mark Wilden" <mark at mwilden.com> writes:

> 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.

Well that is fascinating.  It seems very, very wrong.  Something I might
expect from MySQL, but never postgres... :)


More information about the rspec-users mailing list