Dream of the kind of world
you wanna live in.
Dream it out loud,
at high volume

Bono, U2
an image of thorsten

About me

Ruby developer, guitar music lover, amateur photographer, absolutely galao addicted, and living in Hamburg, Germany, with his wife and his five kids.

My current projects are the Awesome Fontstacks, and my client's website Xing.

I'm the maintainer of AASM (Ruby state machine), exceptionist (Rails engine for enforcing exceptions) and AssertJson (Provide an easy way to test JSON strings)

Latest Blog Entries

01 Nov 2012 Valid fixtures

tl;dr

Validate your fixtures.

Details

As mentioned in our Ploppcasts session about Testing (German only, sorry) I'm using both fixtures and factories when testing my Rails applications. One of the drawbacks from using fixtures is that these don't have to be valid in terms of ActiveModel validations. In order to make sure my fixtures are in fact valid I introduced a fixtures test, which is simply a unit test to automatically verify the fixtures' validity:

So, taken these fixtures:

the test will indicate one failure, because the fixture user_without_email is invalid. The fixture invalid_user won't be marked as failure, because its name is starting with invalid_ telling the test that it should expect an invalid fixture, and return a failure otherwise. By this, we can keep having even invalid fixtures without failing tests.

separator line more...