运行规范抛出“Mysql2 :: Error:表'test_db.xxx'不存在:TRUNCATE TABLE xxx

时间:2013-01-04 15:28:54

标签: ruby-on-rails rspec capybara

使用Rails 3.1.x,DatabaseCleaner gem和capybara 2,我在尝试运行测试时得到以下信息:

 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>'

1 个答案:

答案 0 :(得分:14)

这可以通过运行:

来解决
bundle exec rake db:test:prepare