Skip to content

Instantly share code, notes, and snippets.

@cwebberOps
Created January 24, 2012 23:12
Show Gist options
  • Save cwebberOps/1673392 to your computer and use it in GitHub Desktop.
Save cwebberOps/1673392 to your computer and use it in GitHub Desktop.
rspec-puppet... Doing it wrong
pwd: /Users/cwebber/projects/puppetmaster/puppet/modules/puppet
(15:47:56) cwebber@tron [~/projects/puppetmaster/puppet/modules/puppet] rspec
F
Failures:
1) puppet
Failure/Error: it { should contain_package('puppet').with_ensure('installed') }
Puppet::Error:
Could not find class puppet for genomics-58-102.bulk.ucr.edu at line 2 on node genomics-58-102.bulk.ucr.edu
# ./spec/classes/puppet_init_spec.rb:5:in `block (2 levels) in <top (required)>'
Finished in 0.05606 seconds
1 example, 1 failure
Failed examples:
rspec ./spec/classes/puppet_init_spec.rb:5 # puppet
(15:55:10) cwebber@tron [~/projects/puppetmaster/puppet/modules/puppet] pwd
/Users/cwebber/projects/puppetmaster/puppet/modules/puppet
(15:55:24) cwebber@tron [~/projects/puppetmaster/puppet/modules/puppet] ls -lR
total 0
drwxr-xr-x 2 cwebber staff 68 Jan 24 11:41 files
drwxr-xr-x 3 cwebber staff 102 Jan 24 15:45 manifests
drwxr-xr-x 5 cwebber staff 170 Jan 24 15:05 spec
./files:
./manifests:
total 8
-rw-r--r-- 1 cwebber staff 155 Jan 24 15:45 init.pp
./spec:
total 16
drwxr-xr-x 3 cwebber staff 102 Jan 24 15:46 classes
-rw-r--r-- 1 cwebber staff 47 Jan 24 14:59 spec.opts
-rw-r--r-- 1 cwebber staff 203 Jan 24 15:05 spec_helper.rb
./spec/classes:
total 8
-rw-r--r-- 1 cwebber staff 117 Jan 24 15:46 puppet_init_spec.rb
(15:55:34) cwebber@tron [~/projects/puppetmaster/puppet/modules/puppet]
# = Class: puppet
#
# This class provides for some basics needed for running puppet
#
class puppet {
package { "puppet":
ensure => installed
}
}
(15:59:37) cwebber@tron [~/projects/puppetmaster/puppet/modules/puppet] rspec
F
Failures:
1) puppet
Failure/Error: it { should contain_package('puppet').with_ensure('installed') }
Puppet::Error:
Could not parse for environment production: No file(s) found for import of '/Users/cwebber/.puppet/manifests/site.pp' at line 3 on node genomics-58-102.bulk.ucr.edu
# ./spec/classes/puppet_init_spec.rb:5:in `block (2 levels) in <top (required)>'
Finished in 0.01935 seconds
1 example, 1 failure
Failed examples:
rspec ./spec/classes/puppet_init_spec.rb:5 # puppet
(15:59:42) cwebber@tron [~/projects/puppetmaster/puppet/modules/puppet]
require 'spec_helper'
describe 'puppet' do
it { should contain_package('puppet').with_ensure('installed') }
end
require 'puppet'
require 'rubygems'
require 'mocha'
require 'rspec'
require 'rspec-puppet'
RSpec.configure do |c|
c.mock_with :mocha
# Setting this causes things to break in an even more interesting way...
# c.module_path = File.join(File.dirname(__FILE__), '../../')
end
@wallace
Copy link

wallace commented Oct 23, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment