Case of the "missing" Ruby file

60 views
Skip to first unread message

Peter Berghold

unread,
Jul 20, 2015, 1:39:37 PM7/20/15
to puppet-users
Hi folks,

I've bravely stepped out into the world of writing tests for my Puppet modules to ensure code quality.  Have run into an issue.  My spec/spec_helper.rb has one line.

require 'puppetlabs_spec_helper/module_spec_helper'

I run "rake spec" and this happens:

spec/spec_helper.rb:1:in `require': no such file to load -- puppetlabs_spec_helper/module_spec_helper (LoadError)
        from /home/pb869e/src/pb869e-attbind/spec/spec_helper.rb:1
        -- and more---

I did a " find /usr -name  module_spec_helper.rb " and it shows up here:
/usr/lib/ruby/gems/1.8/gems/puppetlabs_spec_helper-0.10.3/lib/puppetlabs_spec_helper/module_spec_helper.rb

so why isn't it loading?

thoughts?

Felix Frank

unread,
Jul 20, 2015, 10:55:46 PM7/20/15
to puppet...@googlegroups.com
Hi,

so you installed puppet_spec_helper as a gem. This should work, and I'm
not certain what the clean approach of making it work in this scenario
would be. I believe "require 'rubygems'" might help, but I half remember
some issues that can crop up with this.

Personally, I would create a Gemfile, add puppetlabs_spec_helper to it
and run rake through bundler. That should definitely work.

HTH,
Felix

Trevor Vaughan

unread,
Jul 21, 2015, 12:19:37 AM7/21/15
to puppet...@googlegroups.com
Hi Peter,

I would *highly* recommend using something like RVM to manage your ruby installations for testing. This way you can ensure a clean environment and also be sure that you don't have any conflicting modules or environment pollution.

I'm guessing that there's something wrong with your GEM_PATH, but it could be any number of things including conflicts with the system Ruby.

Thanks,

Trevor

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CAArvnv2-4L5qM4iLvNmnjXEAKs2Xi79SJDxqwmWOfKZj-%2BCPeQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.



--
Trevor Vaughan
Vice President, Onyx Point, Inc
(410) 541-6699

-- This account not approved for unencrypted proprietary information --
Reply all
Reply to author
Forward
0 new messages