Rails BDD with Cucumber:没有要加载的文件 -- cucumber-rails

发布于 2024-08-29 19:41:41 字数 549 浏览 1 评论 0原文

我有 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

当我运行“脚本/生成黄瓜”时,我得到 缺少这些必需的宝石: 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

When I run "script/generate cucumber" I get
Missing these required gems:
cucumber-rails

Who can help me to fix this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

南巷近海 2024-09-05 19:41:41

尝试将 config.gem 语句从 environment.rb 移动到 environments/test.rb

编辑

为什么这有效?我不确定,但我的猜测是黄瓜生成器(script/generate cucumber)期望在开发环境中运行,而不是在测试环境中运行。当您在 environment.rb 中声明 config.gem 时,它适用于所有环境。也许生成器在发现 Cucumber-rails 不符合预期的地方时会感到困惑?

我想继续说下去,但我的手腕因为挥手而酸痛……

Try moving the config.gem statement from environment.rb to environments/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 declare config.gem in environment.rb, it applies to all environments. Maybe the generator gets confused when it finds cucumber-rails where it's not expected?

I'd go on, but my wrists are sore from all this hand-waving...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文