rspec cannot load required gems

193 views
Skip to first unread message

Michael Watters

unread,
Apr 23, 2018, 4:38:18 PM4/23/18
to Puppet Users
Has anybody used rspec-puppet to run tests using a function that requires external ruby gems?  I'm running unit tests on resources that call functions in the puppet_thycotic module however rspec is failing with an error as shown below.

Failure/Error: require 'parseconfig'
     
     Puppet::PreformattedError:
       Evaluation Error: Error while evaluating a Function Call, Could not autoload puppet/parser/functions/getsecret: cannot load such file -- parseconfig at /home/username/projects/puppet/modules/example/spec/fixtures/modules/example/manifests/hostname.pp:32:20 on node host.example.com

I've installed the parseconfig gem using both the gem and puppet_gem providers but rspec still complains that it can't find the file.  Any idea how to resolve this?  Is there another directory where rspec looks for gem packages?

Garrett Honeycutt

unread,
Apr 23, 2018, 5:24:08 PM4/23/18
to puppet...@googlegroups.com
Hi Michael,

Try putting the gem in your Gemfile and using bundler when you invoke
rspec, such as `bundle exec rake spec_standalone` or `bundle exec rspec`.

Best regards,
-g

--
Garrett Honeycutt
@learnpuppet
Puppet Training with LearnPuppet.com
Mobile: +1.206.414.8658

Michael Watters

unread,
Apr 23, 2018, 5:33:15 PM4/23/18
to Puppet Users
Thanks.  I found that adding "require 'parseconfig'" to the spec/spec_helper.rb file also allows the tests to run.  bundle exec is failing with dependency errors as well.
Reply all
Reply to author
Forward
0 new messages