0

我对 ruby​​ 很陌生,我工作的公司让我们在签入之前对我们的代码进行本地规范测试。直到几天前,我的规范测试运行良好,但我最近从默认升级OS X ruby​​ 版本 (1.8.7) 到 2.0.0,'rake spec' 现在失败,输出如下,我已经缩写为相关信息:

/Users/Jordan/.rvm/gems/ruby-2.0.0-p247/gems/rspec-puppet-0.1.5/lib/rspec-puppet.rb:1:in `require': cannot load such file -- puppet (LoadError)
from /Users/Jordan/.rvm/gems/ruby-2.0.0-p247/gems/rspec-puppet-0.1.5/lib/rspec-puppet.rb:1:in `<top (required)>'
from /Users/Jordan/edmunds_dev/spec/spec_helper.rb:1:in `require'
from /Users/Jordan/edmunds_dev/spec/spec_helper.rb:1:in `<top (required)>'
from /Users/Jordan/edmunds_dev/modules/apache/spec/classes/apache_spec.rb:1:in `require'
from /Users/Jordan/edmunds_dev/modules/apache/spec/classes/apache_spec.rb:1:in `<top (required)>'
from /Users/Jordan/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load'
from /Users/Jordan/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `block in load_spec_files'
from /Users/Jordan/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `map'
from /Users/Jordan/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core- 2.11.1/lib/rspec/core/configuration.rb:780:in `load_spec_files'
from /Users/Jordan/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-  2.11.1/lib/rspec/core/command_line.rb:22:in `run'
from /Users/Jordan/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:69:in `run'
from /Users/Jordan/.rvm/gems/ruby-2.0.0-p247/gems/rspec-core-2.11.1/lib/rspec/core/runner.rb:8:in `block in autorun'
rake aborted!
/Users/Jordan/.rvm/rubies/ruby-2.0.0-p247/bin/ruby -S rspec 

我尝试了什么:

重新安装 ruby​​ 和所有相关的 gem

更新 ruby​​gems,然后重新安装相关的 gem

查看 Rakefile

我要做什么:

重新安装我的操作系统,或者直接删除名称中包含 ruby​​ 的所有内容并重新安装。

4

1 回答 1

1

似乎puppet还没有为 ruby​​ 2.0.x 安装。您可能已经为 1.8.7 安装了它。所有的 gem 都需要针对最新的 ruby​​ 版本进行安装。

如果使用 Bundler,请确保它puppet在您的 Gemfile 中:

source 'https://rubygems.org'

gem 'puppet'

# Once the issue is ironed out, place this and other spec-related
# gems in the test group
gem 'rspec-puppet'

然后,确保 bundler 通过bundle exec rake spec.

或者手动安装,使用:

gem install puppet

查看rspec-puppet 文档以获取更多详细信息。

于 2013-07-15T20:44:21.670 回答