Rails BDD with Cucumber:没有要加载的文件 -- cucumber-rails
我有 Rails 项目(2.3.5)。我在environment.rb中添加相同的内容:
config.gem“cucumber-rails”,
运行“rake gems:unpack:dependency”。 “rake gems”的输出:
- [F] cucumber-rails
- [F]黄瓜>=0.6.2
- [F] term-ansicolor >= 1.0.4
- [F] 树顶 >= 1.4.2
- [F] 多语言 >= 0.3.1
- [F] 多语言 >= 0.2.9
- [F] 构建器 >= 2.1.2
- [F] diff-lcs >= 1.1.2
- [F] json_pure >= 1.2.0
- [F]黄瓜>=0.6.2
当我运行“脚本/生成黄瓜”时,我得到 缺少这些必需的宝石: cucumber-rails
谁能帮我解决这个问题?
I have project on Rails (2.3.5). I add into environment.rb same sting:
config.gem "cucumber-rails",
run "rake gems:unpack:dependencies". Output of "rake gems":
- [F] cucumber-rails
- [F] cucumber >= 0.6.2
- [F] term-ansicolor >= 1.0.4
- [F] treetop >= 1.4.2
- [F] polyglot >= 0.3.1
- [F] polyglot >= 0.2.9
- [F] builder >= 2.1.2
- [F] diff-lcs >= 1.1.2
- [F] json_pure >= 1.2.0
- [F] cucumber >= 0.6.2
When I run "script/generate cucumber" I get
Missing these required gems:
cucumber-rails
Who can help me to fix this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试将
config.gem
语句从environment.rb
移动到environments/test.rb
编辑
为什么这有效?我不确定,但我的猜测是黄瓜生成器(
script/generate cucumber
)期望在开发环境中运行,而不是在测试环境中运行。当您在environment.rb
中声明config.gem
时,它适用于所有环境。也许生成器在发现 Cucumber-rails 不符合预期的地方时会感到困惑?我想继续说下去,但我的手腕因为挥手而酸痛……
Try moving the
config.gem
statement fromenvironment.rb
toenvironments/test.rb
EDIT
Why does this work? I'm not sure, but my guess would be that the cucumber generator (
script/generate cucumber
) is expecting to run in the development environment, and not the test environment. When you declareconfig.gem
inenvironment.rb
, it applies to all environments. Maybe the generator gets confused when it findscucumber-rails
where it's not expected?I'd go on, but my wrists are sore from all this hand-waving...