【发布时间】:2015-11-22 00:38:49
【问题描述】:
我有一些可以通过以下命令运行的主厨单元测试: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:inrequire': 无法加载此类文件 -- chefspec (LoadErr
要么)
来自 C:/Ruby22/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in require'
from D:/../spec/octopus_tentacle_spec.rb:1:in'
来自 C:/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:inblock in load_
规格文件'
来自 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:inload_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:inrun'
来自 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:ininvoke'
来自 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:inload'
来自 C:/Ruby22/bin/rspec:23:in <main>'
【问题讨论】:
标签: ruby rspec rake teamcity chefspec