Question

I installed Rails + Spork + Minitest + Autotest as shown by S. Christoffer Eliesen in how-to-combine-autotest-and-spork-in-rails-testing and it works great for tests that doesn't involve the database. It doesn't work if I add a model though:

rails g scaffold post name:string
rake db:migrate

It then gives me the following error:

ActiveRecord::StatementInvalid: Could not find table 'posts'

How can I make it "see" the database/table changes?

Was it helpful?

Solution

You need to run the migration in the test environment as well.

rake db:migrate RAILS_ENV=test
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top