Search code examples
mysqlruby-on-railsrspecguardspork

spork/guard reload schema


I use spork and guard to speed up the test suite in my Rails 3.2 application. However the tests in guard behave strange after adding a new migration: they act as they don't know about the changes in schema, even though I run rake db:migrate before. They start to behave correctly when I stop guard and run rake spec. I suppose that it behaves this way, because spork/guard doesn't update schema before tests. Is it possible to configure spork to update schema on #prefork and guard to reload spork on schema changes?


Solution

  • You need to run rake db:test:prepare to apply migrations for testing environment.