So,
Now that my schedule has some slack in it I've turned my attention back to doing spec testing of my Puppet modules. Taking a really really simple module that I wrote as an example I started in again.
Here is the one and only file making up the class.
---------- init.pp ------------------------------
class ntp {
package { 'ntp':
ensure => latest
}
service { 'ntp':
ensure => running,
enable => true,
require => Package[ntp]
}
}
-----------------------------------------------------
That should be really easy to run tests against in my opinion. I wrote a Gemfle for the occasion.
---------Gemfile---------------------------
puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>= 3.3']
gem 'puppet', puppetversion
gem 'puppetlabs_spec_helper', '>= 0.1.0'
gem 'puppet-lint', '>= 0.3.2'
gem 'facter', '>= 1.7.0'
gem 'rake','>= 0.0.0'
gem 'spec','>= 0.0.0'
--------------------------------------------------------------------
and my spec file looks like this:
------- spec/classes/init_spec.rb ---------------
require 'spec_helper'
describe 'ntp', :type => 'class' do
context 'On Debian' do
let :facts do {
:osfamily => 'Debian'
}
end
it {
should contain_package('ntp').with({ 'name' => 'ntp' })
should contain_service('ntp').with({ 'name' => 'ntp' })
}
end
end
-------------------------------------------------------------------
and when I run "rake spec" I get this (severely trimmed) set of errors:
-------------errors--------------------------------------------------
1) ntp On Debian should contain Package[ntp] with name => "ntp"
Failure/Error: should contain_package('ntp').with({ 'name' => 'ntp' })
ArgumentError:
wrong number of arguments (2 for 1)
------------------------------------------------------------------------
there should only be one argument to "with" so.. if that's not an authoritative page for that information, which one is?
Can somebody clarify for me what;s going on here?