1

我正在按照此处的说明进行操作

gem install rvm
gem install bundle

# Demo dir

# Gemfile
source "https://rubygems.org"

gem 'rspec-puppet', :require => false
gem 'puppetlabs_spec_helper',  :require => false
gem 'puppet', '~> 3.7.5'
gem 'rspec-puppet-facts'

# spec_helper.rb
require 'puppetlabs_spec_helper/module_spec_helper'
require 'rspec-puppet-facts'
include RspecPuppetFacts     

现在,当我运行时bundle exec rake spec,出现以下错误:

/usr/bin/ruby -I/usr/lib64/ruby/gems/1.8/gems/rspec-core-3.3.1/lib:/usr/lib/ruby/gems/1.8/gems/rspec-support-3.3.0/lib /usr/lib64/ruby/gems/1.8/gems/rspec-core-3.3.1/exe/rspec --pattern spec/\{classes,defines,unit,functions,hosts,integration\}/\*\*/\*_spec.rb --color

Total resources:   0
Touched resources: 0
Resource coverage:  -nan%
Untouched resources:


/usr/lib64/ruby/gems/1.8/gems/rspec-core-3.3.1/lib/rspec/core/hooks.rb:516:in `all_hooks_for': return from proc-closure (LocalJumpError)
    from /usr/lib64/ruby/gems/1.8/gems/rspec-core-3.3.1/lib/rspec/core/hooks.rb:568:in `process'
    from /usr/lib64/ruby/gems/1.8/gems/rspec-core-3.3.1/lib/rspec/core/flat_map.rb:12:in `map'
    from /usr/lib64/ruby/gems/1.8/gems/rspec-core-3.3.1/lib/rspec/core/flat_map.rb:12:in `flat_map'
    from /usr/lib64/ruby/gems/1.8/gems/rspec-core-3.3.1/lib/rspec/core/hooks.rb:567:in `process'
    from /usr/lib64/ruby/gems/1.8/gems/rspec-core-3.3.1/lib/rspec/core/hooks.rb:433:in `register_globals'
    from /usr/lib64/ruby/gems/1.8/gems/rspec-core-3.3.1/lib/rspec/core/example_group.rb:395:in `set_it_up'
    from /usr/lib64/ruby/gems/1.8/gems/rspec-core-3.3.1/lib/rspec/core/example_group.rb:362:in `subclass'
    from /usr/lib64/ruby/gems/1.8/gems/rspec-core-3.3.1/lib/rspec/core/example_group.rb:254:in `describe'
    from /usr/lib64/ruby/gems/1.8/gems/rspec-core-3.3.1/lib/rspec/core/dsl.rb:43:in `__send__'
    from /usr/lib64/ruby/gems/1.8/gems/rspec-core-3.3.1/lib/rspec/core/dsl.rb:43:in `describe'
    from /usr/lib64/ruby/gems/1.8/gems/rspec-core-3.3.1/lib/rspec/core/dsl.rb:82:in `__send__'
    from /usr/lib64/ruby/gems/1.8/gems/rspec-core-3.3.1/lib/rspec/core/dsl.rb:82:in `describe'
    from /etc/puppet/modules/demo/spec/classes/example_spec.rb:3
    from /usr/lib64/ruby/gems/1.8/gems/rspec-core-3.3.1/lib/rspec/core/configuration.rb:1327:in `load'
    from /usr/lib64/ruby/gems/1.8/gems/rspec-core-3.3.1/lib/rspec/core/configuration.rb:1327:in `load_spec_files'
    from /usr/lib64/ruby/gems/1.8/gems/rspec-core-3.3.1/lib/rspec/core/configuration.rb:1325:in `each'
    from /usr/lib64/ruby/gems/1.8/gems/rspec-core-3.3.1/lib/rspec/core/configuration.rb:1325:in `load_spec_files'
    from /usr/lib64/ruby/gems/1.8/gems/rspec-core-3.3.1/lib/rspec/core/runner.rb:102:in `setup'
    from /usr/lib64/ruby/gems/1.8/gems/rspec-core-3.3.1/lib/rspec/core/runner.rb:88:in `run'
    from /usr/lib64/ruby/gems/1.8/gems/rspec-core-3.3.1/lib/rspec/core/runner.rb:73:in `run'
    from /usr/lib64/ruby/gems/1.8/gems/rspec-core-3.3.1/lib/rspec/core/runner.rb:41:in `invoke'
    from /usr/lib64/ruby/gems/1.8/gems/rspec-core-3.3.1/exe/rspec:4
/usr/bin/ruby -I/usr/lib64/ruby/gems/1.8/gems/rspec-core-3.3.1/lib:/usr/lib/ruby/gems/1.8/gems/rspec-support-3.3.0/lib /usr/lib64/ruby/gems/1.8/gems/rspec-core-3.3.1/exe/rspec --pattern spec/\{classes,defines,unit,functions,hosts,integration\}/\*\*/\*_spec.rb --color failed

关于如何解决这个问题的任何想法?或者有人可以提供一些关于如何让它在 CentOS 6.5 机器上工作的明确说明?

4

1 回答 1

1

更新Gemfile到以下并运行bundle update有效:

source 'https://rubygems.org'

if puppetversion = ENV['PUPPET_GEM_VERSION']
  gem 'puppet', puppetversion, :require => false
else
  gem 'puppet', '3.7.5' 
end


gem 'metadata-json-lint'
gem 'puppetlabs_spec_helper', '>= 0.1.0'
gem 'puppet-lint', '>= 1.0.0'
gem 'facter', '>= 1.7.0'
gem 'rspec-puppet-facts' 


# rspec must be v2 for ruby 1.8.7
if RUBY_VERSION >= '1.8.7' and RUBY_VERSION < '1.9'
  gem 'rspec', '~> 2.0'
end
于 2015-06-28T08:11:57.593 回答