Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running specs throws "Mysql2::Error: Table 'test_db.xxx' doesn't exist: TRUNCATE TABLE xxx

Using Rails 3.1.x, DatabaseCleaner gem and capybara 2, I get the following when trying to run the 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>'
like image 707
micho Avatar asked Jan 04 '13 15:01

micho


1 Answers

This is solved by running:

bundle exec rake db:test:prepare
like image 132
micho Avatar answered Oct 09 '22 06:10

micho