【问题标题】:Ruby Aruba testing can't find command in PATH-variableRuby Aruba 测试在 PATH 变量中找不到命令
【发布时间】:2017-07-18 18:58:52
【问题描述】:

我正在自学如何使用 Bundler 的 guide 制作自己的 Ruby Gem 的基础知识。但是,当我开始使用 aruba/cucumber 设置 CLI 测试时,我一直遇到问题:

Command "co2domain" not found in PATH-variable "C:/.../PATH variables". (Aruba::LaunchError)

我所做的唯一区别是更改了示例的一些名称,因为我最终希望构建一个将公司名称转换为其正确域的 gem。

这是我的 company.feature 文件:

Feature: Company
  In order to portray Company
  As a CLI
  I want to be as objective as possible

  Scenario: Positive number
    When I run `co2domain portray --num 2`
    Then the output should contain "positive"

  Scenario: Negative number
    When I run `co2domain portray --num -22`
    Then the output should contain "negative"

这是我的 company.rb 文件:

module Co2domain
  class Company
    def self.portray(num)
      if num > 0
        "positive"
      else
        "negative"
      end
    end
  end
end

由于我是初学者,而且该指南是为初学者准备的,我觉得我遗漏了一些小而重要的东西。帮助表示赞赏。

【问题讨论】:

    标签: ruby rubygems cucumber aruba


    【解决方案1】:

    您看到的错误等同于您使用的指南中的sh: foodie: command not found 错误。不同的是你使用的是windows机器,而指南使用的是*nix机器。

    黄瓜测试正在测试从 shell 运行命令,而 shell 无法找到要运行的命令。如果将程序所在的目录添加到 PATH,或者将程序移动到路径中的目录,黄瓜应该能够运行它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-02
      • 2016-11-20
      • 2020-04-12
      • 2018-01-07
      • 2019-11-29
      • 1970-01-01
      相关资源
      最近更新 更多