puppet rspec no such file to load -- rspec-puppet (LoadError)

Posted by Vorsprung on Ask Ubuntu See other posts from Ask Ubuntu or by Vorsprung
Published on 2013-12-18T20:30:21Z Indexed on 2014/06/04 15:44 UTC
Read the original article Hit count: 741

Filed under:
|
|
|

I have no prior experience at all of ruby. I am not interested in ruby (and so have no knowledge of rails etc) as such but am using puppet to manage a group of servers. I have written some modules and the rspec-puppet system looks like it would be very useful.

However, I cannot get rspec-puppet to work

I am using Ubuntu LTS 10.04

I have installed puppet rspec using the directions on their web page

What I actually did

apt-get install rubygems # (installs 1.8)
gem install rspec-expectations
gem install rspec-puppet

I also installed librspec-ruby1.8

Then I ran rspec-puppet-init in a puppet module directory I'd already made (it's a working puppet module)

I made a file as defined in the tutorial

$ more spec/defines/rule_spec.rb 
require 'spec_helper'

describe 'vanusers::rule' do
let(:title) { 't1' }

it { should contain_class('vanusers::JamieA') }
end

but when I try and run it there is a mysterious dependancy issue

$ spec spec/defines/rule_spec.rb 
/home/jamie/git/puppet/modules/vanusers/spec/spec_helper.rb:1:in `require': no such file to load -- rspec-puppet (LoadError)
    from /home/jamie/git/puppet/modules/vanusers/spec/spec_helper.rb:1
    from ./spec/defines/rule_spec.rb:1:in `require'
    from ./spec/defines/rule_spec.rb:1
    from /usr/lib/ruby/1.8/spec/runner/example_group_runner.rb:15:in `load'
    from /usr/lib/ruby/1.8/spec/runner/example_group_runner.rb:15:in `load_files'
    from /usr/lib/ruby/1.8/spec/runner/example_group_runner.rb:14:in `each'
    from /usr/lib/ruby/1.8/spec/runner/example_group_runner.rb:14:in `load_files'
    from /usr/lib/ruby/1.8/spec/runner/options.rb:132:in `run_examples'
    from /usr/lib/ruby/1.8/spec/runner/command_line.rb:9:in `run'
    from /usr/bin/spec:3

Here is the solution I came up with in the end::

apt-get install rubygems
gem install rspec-expectations rspec-puppet puppet-lint puppetlabs_spec_helper

so your path picks up the gem stuff

export PATH=/var/lib/gems/1.8/bin:$PATH

cd into module and

rm spec/spec_helper.rb

rspec-puppet-init

replace Rakefile with

require 'rake'
require 'rspec/core/rake_task'
require 'puppetlabs_spec_helper/rake_tasks'

Then "rake spec" to run tests or "rake lint" to check files

http://sysadvent.blogspot.co.uk/2013/12/day-22-getting-started-testing-your.html was an excellent source of info

© Ask Ubuntu or respective owner

Related posts about 10.04

  • An increase to 3 Gig of RAM slows down Ubuntu 10.04 LTS

    as seen on Ask Ubuntu - Search for 'Ask Ubuntu'
    I have Ubuntu 10.04 running from an external hard drive (installed on an enclosure) connected via USB port. Like a month or so ago, I increased RAM on my pc from 2 Gigs to 3 Gigs. This resulted on extremely long boot times and slow application loads. While I was understanding the nature of my problem… >>> More

  • Default /etc/apt/sources.list?

    as seen on Ask Ubuntu - Search for 'Ask Ubuntu'
    I need default source list for ubuntu 10.04. Can anybody help me? Here is Mine:--- Ubuntu supported packages deb http://archive.ubuntu.com/ubuntu/ lucid main restricted multiverse universe deb http://archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse deb http://archive… >>> More

  • SSH main process ended

    as seen on Ask Ubuntu - Search for 'Ask Ubuntu'
    I have a running ubuntu server 10.04.1. When I tried to login to the server via ssh, I could not. Instead, I got connection refused error. I tried to ping the machine and I got reply! So, the clear reason is that SSH daemon is stopped. After reboot, I was able to login to my server via ssh. After… >>> More

  • PPA causing 404 error?

    as seen on Ask Ubuntu - Search for 'Ask Ubuntu'
    I need default source list for ubuntu 10.04. Can anybody help me? Here is Mine:--- Ubuntu supported packages deb http://archive.ubuntu.com/ubuntu/ lucid main restricted multiverse universe deb http://archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse deb http://archive… >>> More

  • Postgresql fails to start on Ubuntu 10.04.4 LTS

    as seen on Ask Ubuntu - Search for 'Ask Ubuntu'
    I installed postgresql 9.2 from add-apt-repository ppa:pitti/postgresql using apt-get install postgresql-9.2 At the end of the install and every time I try to launch postgresql by using the following command /etc/init.d/postgresql start or service postgresql start I get this error: Error:… >>> More

Related posts about ruby