Skip to content

Instantly share code, notes, and snippets.

@miketheman
Created April 22, 2013 20:58
Show Gist options
  • Save miketheman/5438491 to your computer and use it in GitHub Desktop.
Save miketheman/5438491 to your computer and use it in GitHub Desktop.
chefspec example
node.default['foo']['bar'] = nil
require 'chefspec'
describe 'foo::default' do
context 'when converging this recipe' do
let(:runner) do
ChefSpec::ChefRunner.new(platform:'ubuntu', version:'12.04') do |node|
node.set['foo'] = {
'bar' => "somethingnotnil"
}
end
end
before do
runner.converge 'foo::default'
end
it 'installs the gcc package' do
runner.should install_package 'gcc'
end
end
end
raise "Didn't find valid node['foo']['bar'] attribute" if node['foo'] && node['foo']['bar'].nil?
package 'gcc'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment