在黄瓜规格中访问root_path时出错

时间:2013-11-06 09:56:10

标签: ruby-on-rails ruby-on-rails-3 cucumber bdd

在我的黄瓜步骤定义文件中,我有以下内容:

Given(/^I am on the home page$/) do
  visit root_path
end

但是当我运行规格时,上面的

会出现以下错误
Given I am on the home page           # features/step_definitions/select_country_webpublisher_and_targettype_steps.rb:1
      Mysql2::Error: Table 'geomapping_tool_test.countrycode' doesn't exist: SHOW FULL FIELDS FROM `CountryCode` (ActiveRecord::StatementInvalid)
      ./app/controllers/geo_mapping_controller.rb:3:in `index'
      ./features/step_definitions/select_country_webpublisher_and_targettype_steps.rb:2:in `/^I am on the home page$/'
      features/select_country_webpublisher_and_targettype.feature:7:in `Given I am on the home page'

我的rails应用程序中有一个名为CountryCode的模型,该模型连接到具有相同名称的表的旧数据库,因此在模型中我有self.table_name = 'CountryCode',这会影响测试吗?

请帮助 谢谢

1 个答案:

答案 0 :(得分:0)

您是否已“准备好”您的测试数据库?

rake db:test:prepare