Ruby on rails 未定义的方法`添加';在通常有效的黄瓜台阶上

Ruby on rails 未定义的方法`添加';在通常有效的黄瓜台阶上,ruby-on-rails,cucumber,Ruby On Rails,Cucumber,我定义了一个路径: when /the admin home\s?page/ "/admin/" 我有一个即将过去的场景: Scenario: Let admins see the admin homepage Given "pojo" is logged in And "pojo" is an "admin" And I am on the admin home page Then I should see "Hi there." 我有一个失败的场景

我定义了一个路径:

when /the admin home\s?page/
  "/admin/"
我有一个即将过去的场景:

  Scenario: Let admins see the admin homepage
    Given "pojo" is logged in
    And "pojo" is an "admin"
    And I am on the admin home page
    Then I should see "Hi there."
我有一个失败的场景:

  Scenario: Review flagged photo
    Given "pojo" is logged in
    And "pojo" is an "admin"
  ...bunch of steps that create stuff in the database...
    And I am on the admin home page
    Then ... the rest of the steps
在第二个场景中失败的步骤是“我在管理员主页上”,这在第一个场景中通过得很好

下面是我得到的错误:

And I am on the admin home page                 # features/step_definitions/web_steps.rb:18
  undefined method `add' for {}:Hash (NoMethodError)
  ./app/controllers/admin_controller.rb:13:in `index'
  ./app/controllers/admin_controller.rb:11:in `each'
  ./app/controllers/admin_controller.rb:11:in `index'
  /usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
  ./features/step_definitions/web_steps.rb:19:in `/^(?:|I )am on (.+)$/'
  features/admin.feature:52:in `And I am on the admin home page'
这很奇怪。。。为什么在第一种情况下可以,而在第二种情况下则不行,因为第二种情况的唯一区别是在数据库中创建记录的一系列步骤

[编辑]

下面是向数据库添加内容的步骤:

Given /^there is a "([^\"]*)" with the following:$/ do |model, table|
  model.constantize.create!(table.rows_hash)
end

没关系,我只是太累了,无法阅读自己的错误消息。

为了完整起见:如果我没有包括“向数据库添加内容”步骤,则该步骤将通过。从第11行到第13行,管理员控制器会做什么?…哦。。。。好的,没关系P这是漫长的一天。