我对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和所有相关的宝石
更新rubygems,然后重新安装相关的宝石
查看Rakefile
我要做的事情:
重新安装我的操作系统,或者只是弹道删除名称中包含红宝石的所有内容并重新安装。
答案 0 :(得分:1)
似乎尚未为ruby 2.0.x安装puppet
。您可能安装了1.8.7。所有宝石都需要安装最新的ruby版本。
如果使用Bundler,请确保Gemfile中有puppet
:
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
查看the rspec-puppet documentation了解更多详情。