我有一些可以通过命令运行的主厨单元测试:chef exec rspec
但是,我正在尝试从 TeamCity 运行这些,并且我正在使用 rakefile。当我尝试执行 rakefile 时,测试文件中的 require 'chefspec' 行会导致错误"cannot load such file -- chefspec (LoadError)"
我知道chefspec已安装。我是 Ruby、chefspec、rspec 的新手。我知道提到了一个 gemspec 文件,我试图在可以运行命令chef exec rspec
来执行测试的目录中创建一个。但是,当我尝试运行时,bundle install
我得到了错误Could not locate Gemfile or .bundle/ directory
。安装 ruby 时是否有 gemfile 的默认位置?在这一点上我很迷茫。
C:/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in
require': 无法从 C:/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in 加载此类文件 -- chefspec (LoadErr or) from C require'
from D:/../spec/octopus_tentacle_spec.rb:1:in
:/Ruby22/lib/ruby/ gems/2.2.0/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1327:in load'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1327:in
block in load_spec_files' from C:/Ruby22/lib/ruby/gems/2.2.0/ gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1325:in each'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1325:in
load_spec_file 来自 C:/Ruby22/lib/ruby/gems/2.2.0/gems/rspec-core-3.3。 2/lib/rspec/core/runner.rb:102:in setup'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:88:in
run' 来自 C:/Ruby22/lib/ruby/gems/2.2.0/gems/rspec-core-3.3.2/lib/rspec/core/runner .rb:73:in run'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:41:in
invoke' 来自 C:/Ruby22/lib/ruby/gems/2.2.0/gems/rspec-core-3.3.2/exe/rspec:4:in <top (required)>'
from C:/Ruby22/bin/rspec:23:in
load' 来自 C:/Ruby22/bin /rspec:23:in<main>'