puppetlabs_spec_helper: rspec not initialised via puppet_spec_helper
If a project requires
puppetlabs_spec_helper/puppet_spec_helper directly then rspec doesn’t seem to be initialised correctly. If you instead require
module_spec_helper then it does, perhaps due to rspec-puppet being pulled in.
From my augeasproviders project, I get:
/home/dcleal/.gem/ruby/1.9.1/gems/puppetlabs_spec_helper-0.1.0.11/lib/puppetlabs_spec_helper/puppetlabs_spec/matchers.rb:6:in `<module:RSpec>': cannot load such file -- rspec/matchers (LoadError) from /home/dcleal/.gem/ruby/1.9.1/gems/puppetlabs_spec_helper-0.1.0.11/lib/puppetlabs_spec_helper/puppetlabs_spec/matchers.rb:5:in `<top (required)>'
From puppetlabs-mount_providers (after changing the require, as per #15543):
/home/dcleal/.gem/ruby/1.9.1/gems/puppetlabs_spec_helper-0.1.0.11/lib/puppetlabs_spec_helper/puppetlabs_spec/matchers.rb:8:in `alias_method': undefined method `should' for module `RSpec::Matchers::BlockAliases' (NameError) from /home/dcleal/.gem/ruby/1.9.1/gems/puppetlabs_spec_helper-0.1.0.11/lib/puppetlabs_spec_helper/puppetlabs_spec/matchers.rb:8:in `<module:BlockAliases>'
These stop if you edit
puppet_spec_helper.rb and move the requires for mocha, rspec and
rspec/expectations to be above the require for
puppetlabs_spec_helper/puppetlabs_spec_helper (the latter seems to start setting up matchers).
This seems related to PR 10, which seems to have worked around it for the coverage task but perhaps not truly fixed the issue.