如何解决在泡菜中使用泡菜吗?
| 当我使用spork时,Pickle似乎没有为我加载... 如果我正常运行黄瓜,则该步骤将按预期工作:➜ bundle exec cucumber
And a product exists with name: \"Windex\",category: \"Household Cleaners\",description: \"nasty bluish stuff\" # features/step_definitions/pickle_steps.rb:4
但是,如果我通过spork运行它,则会得到一个未定义的步骤:
您可以使用以下代码段为未定义的步骤实现步骤定义:
Given /^a product exists with name: \"([^\"]*)\",category: \"([^\"]*)\",description: \"([^\"]*)\"$/ do |arg1,arg2,arg3|
pending # express the regexp above with the code you wish you had
end
是什么赋予了?
解决方法
因此,事实证明,使用spork时,
features/support/env.rb
需要额外的一条配置行,以使Pickle能够在AR模型上进行拾取,这是一个要点:
在features/support/env.rb
Spork.prefork do
ENV[\"RAILS_ENV\"] ||= \"test\"
require File.expand_path(File.dirname(__FILE__) + \'/../../config/environment\')
# So that Pickle\'s AR adapter properly picks up the application\'s models.
Dir[\"#{Rails.root}/app/models/*.rb\"].each { |f| load f }
# ...
end
在此行中添加可解决我的问题。本质上,这比守卫更像是杂散问题。我将更新我的问题...
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。