Created
April 22, 2013 20:58
-
-
Save miketheman/5438491 to your computer and use it in GitHub Desktop.
chefspec example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node.default['foo']['bar'] = nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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