Don’t leave empty test fixtures in your Rails projects

A friendly word of advice: don’t leave empty test fixtures in your Rails projects. In some situations, it can cause unexpected test failures that are quite nasty to track down.

Comments

2 responses to “Don’t leave empty test fixtures in your Rails projects”

  1. Nathaniel Talbott Avatar

    Interesting… I’ve never seen that (and I leave them littered all over the place). What causes the failure? Inquiring minds want to know 🙂

  2. Matthew Bass Avatar

    I’m not 100% sure exactly what happened, but the forces of validation, a stale test database, and a legacy table that didn’t allow null values appeared to collide in a perfect storm of testing misery. As soon as I removed the empty test fixture, the skies got clear again.