Skip to content

Instantly share code, notes, and snippets.

@mohitsethi
Created October 8, 2015 06:12
Show Gist options
  • Select an option

  • Save mohitsethi/8bf1c3e305675423b970 to your computer and use it in GitHub Desktop.

Select an option

Save mohitsethi/8bf1c3e305675423b970 to your computer and use it in GitHub Desktop.
require 'spec_helper'
describe 'apache::default' do
let(:chef_run) {
ChefSpec::SoloRunner.new do |node|
# node.automatic['ipaddress'] = '10.10.10.10'
end.converge(described_recipe)
}
it 'install package apache2' do
expect(chef_run).to install_package('apache2')
end
it 'service apache2 should be running' do
expect(chef_run).to start_service('apache2')
end
it 'enable service apache2 at boot time' do
expect(chef_run).to enable_service('apache2')
end
it 'execute apt-get update -y' do
expect(chef_run).to run_execute('sudo apt-get update -y')
end
it 'print some log' do
chef_run.node.automatic['ipaddress'] = "127.0.0.1"
expect(chef_run).to write_log("=== some log === 127.0.0.1")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment