Tuesday, March 6, 2007

Voodoo Considered Harmful

The handiness of rake test:* is undeniable, but be warned; there's weirdness thereabouts. Today I ran into errors which couldn't be explained easily, but which disappeared magically if you ran rake db:test:prepare beforehand. There's some kind of magic in there, and you should watch out for it.


  1. What kind of errors ? You don't tell us much, and I'm not sure anyone can help you here.

    test:db:prepare is used to copy your development database to your test database. The test:* tasks depend on test:db:prepare.

  2. Well, it's more a sort of general heads-up. It was on my other box, so I'll take a look at my history and see if I can find something a little more specific and useful. Basically we have a postgres database, we decided to add some foreign key and not null constraints. It makes sense that you might have to call db:test:prepare to prepare the test database, but there was an instance where using it wasn't obvious yet turned out to be unnecessary. Unfortunately one of those heat of battle things, sorry about the vagueness there.

  3. (Sorry, turned out to be necessary, not unnecessary.)


Note: Only a member of this blog may post a comment.