Execution of specifications throws "Mysql2 :: Error: Table" test_db.xxx "does not exist: TRUNCATE TABLE xxx

Using Rails 3.1.x, DatabaseCleaner gem and capybara 2, I get the following when trying to run tests:

Failure/Error: Unable to find matching line from backtrace ActiveRecord::StatementInvalid: Mysql2::Error: Table 'teambox_test_default.incoming_emails' doesn't exist: TRUNCATE TABLE incoming_emails # ./config/initializers/connection_fix.rb:24:in `execute' # -e:1:in `<main>' 
+6
source share
1 answer

This is solved by running:

 bundle exec rake db:test:prepare 
+11
source

All Articles