title: How do I test Rails migrations?
body: <p>I want to test that certain conditions hold after running a migration I've written. What's the current best way to do that?</p>
  
  <p>To make this concrete: I made a migration that adds a column to a model, and gives it a default value. But I forgot to update all the pre-existing instances of that model to have that default value for the new column. None of my existing tests will catch that, because they all start with a fresh database and add new data, which will have the default. But if I push to production, I know things will break, and I want my tests to tell me that.</p>
  
  <p>I've found <a href="http://spin.atomicobject.com/2007/02/27/migration-testing-in-rails/" rel="noreferrer">http://spin.atomicobject.com/2007/02/27/migration-testing-in-rails/</a>, but haven't tried it. It's very old. Is that the state-of-the-art?</p>