The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

Bug #15545

puppetlabs_spec_helper: rspec not initialised via puppet_spec_helper

Added by Dominic Cleal about 2 years ago. Updated almost 2 years ago.

Status:UnreviewedStart date:07/16/2012
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:spec_helperSpent time:-
Target version:-
Keywords: Branch:

We've Moved!

Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com

This ticket may be automatically exported to the MODULES project on JIRA using the button below:


Description

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.


Related issues

Blocks Puppet Labs Modules - Bug #15543: mount_providers doesn't load puppetlabs_spec_helper corre... Unreviewed 07/16/2012

History

#1 Updated by Ryan Coleman almost 2 years ago

  • Category set to spec_helper

Also available in: Atom PDF