Ruby Aruba测试无法在PATH变量中找到命令

时间:2017-07-18 18:58:52

标签: ruby rubygems cucumber aruba

我自学了如何使用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

由于我是初学者并且指南适合初学者,我觉得我错过了一些小而重要的东西。帮助赞赏。

1 个答案:

答案 0 :(得分:0)

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

黄瓜测试正在测试从shell运行命令,并且shell无法找到要运行的命令。如果您将程序所在的目录添加到PATH中,或将程序移动到路径中的目录,那么黄瓜应该可以运行它。