Created
May 10, 2013 03:14
-
-
Save jtimberman/5552182 to your computer and use it in GitHub Desktop.
this is cookbooks/java/spec/default_spec.rb. Then install the chefspec gem and run rspec. (yay!)
This file contains hidden or 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 'java::default' do | |
let (:chef_run) { ChefSpec::ChefRunner.new.converge('java::default') } | |
it 'should include the openjdk recipe by default' do | |
chef_run.should include_recipe 'java::openjdk' | |
end | |
context 'windows' do | |
let(:chef_run) do | |
runner = ChefSpec::ChefRunner.new( | |
'platform' => 'windows', | |
'version' => '2008R2' | |
) | |
runner.node.set['java']['install_flavor'] = 'windows' | |
runner.node.set['java']['windows']['url'] = 'http://example.com/windows-java.msi' | |
runner.converge('java::default') | |
end | |
it 'should include the windows recipe' do | |
chef_run.should include_recipe 'java::windows' | |
end | |
end | |
context 'oracle' do | |
let(:chef_run) do | |
runner = ChefSpec::ChefRunner.new | |
runner.node.set['java']['install_flavor'] = 'oracle' | |
runner.converge('java::default') | |
end | |
it 'should include the oracle recipe' do | |
chef_run.should include_recipe 'java::oracle' | |
end | |
end | |
context 'oracle_i386' do | |
let(:chef_run) do | |
runner = ChefSpec::ChefRunner.new | |
runner.node.set['java']['install_flavor'] = 'oracle_i386' | |
runner.converge('java::default') | |
end | |
it 'should include the oracle_i386 recipe' do | |
chef_run.should include_recipe 'java::oracle_i386' | |
end | |
end | |
context 'ibm' do | |
let(:chef_run) do | |
runner = ChefSpec::ChefRunner.new | |
runner.node.set['java']['install_flavor'] = 'ibm' | |
runner.node.set['java']['ibm']['url'] = 'http://example.com/ibm-java.bin' | |
runner.converge('java::default') | |
end | |
it 'should include the ibm recipe' do | |
chef_run.should include_recipe 'java::ibm' | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment