【问题标题】:Cucumber step definitions and dependencies in GemfileGemfile 中的 Cucumber 步骤定义和依赖项
【发布时间】:2014-05-24 09:00:05
【问题描述】:

我想为依赖于一系列宝石的黄瓜创建步骤定义。 当我将它放在与步骤定义相同的目录中时,Cucumber 似乎没有拾取 Gemfile。 以详细模式运行黄瓜会导致以下输出:

  • ../../product/feature-step/Gemfile [不支持]
  • ../../product/feature-step/Gemfile.lock [不支持]

【问题讨论】:

标签: cucumber


【解决方案1】:

我发现我可以应用为 SO 问题提供的解决方案:Bundler - load multiple Gemfiles。

这归结为将代码放入包含 cucumber 依赖项的 Gemfile 中,以枚举文件夹结构中的所有相关 Gemfile,其中功能和步骤(可以进一步自定义)并评估它们。

Bundler 能够像处理原始 Gemfile 的一部分一样处理它们:

# Install gems from all subdirectories in <rootdir>
Dir.glob(File.join(File.dirname(__FILE__), 'rootdir', '**', "Gemfile")) do |gemfile|
   eval(IO.read(gemfile), binding)
end

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-08-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多