Last active
August 29, 2015 13:58
-
-
Save parnurzeal/10228276 to your computer and use it in GitHub Desktop.
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
source 'https://rubygems.org' | |
group :test do | |
gem 'chefspec', '~> 3.4.0' | |
gem 'foodcritic', '~> 3.0.3' | |
gem 'strainer', '~> 3.0' | |
gem 'test-kitchen', '~> 1.2.1' | |
gem 'knife-spork', '~> 1.3.2' | |
gem 'hipchat', '~> 1.1.0' | |
gem 'guard', '~> 1.8.3' | |
gem 'guard-foodcritic', '~> 1.0.2' | |
gem 'guard-rspec', '~> 3.1.0' | |
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
require 'spec_helper' | |
# Replace USERNAME with your username! | |
describe 'USERNAME-myface::default' do | |
let(:chef_run) do | |
run = ChefSpec::ChefRunner.new(platform: 'ubuntu', version: '12.04') | |
run.converge('USERNAME-myface::default') | |
end | |
it 'installs apache2' do | |
expect(chef_run).to install_package('apache2') | |
end | |
it 'starts the apache2 service' do | |
expect(chef_run).to start_service('apache2') | |
end | |
it 'sets apache2 to start on boot' do | |
expect(chef_run).to set_service_to_start_on_boot 'apache2' | |
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
require 'chefspec' |
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
guard :rspec, cli: '--color', all_on_start: false do | |
watch(%r{^spec/.+_spec\.rb$}) | |
watch(%r{recipes/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } | |
watch('spec/spec_helper.rb') { 'spec' } | |
end | |
guard :foodcritic, cookbook_paths: '.', all_on_start: false do | |
watch(%r{attributes/.+\.rb$}) | |
watch(%r{providers/.+\.rb$}) | |
watch(%r{recipes/.+\.rb$}) | |
watch(%r{resources/.+\.rb$}) | |
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
knife: bundle exec knife cookbook test $COOKBOOK | |
foodcritic: bundle exec foodcritic $SANDBOX/$COOKBOOK -f any | |
rspec: (cd $COOKBOOK && bundle exec rspec --color --format documentation) |
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
package 'apache2' | |
service 'apache2' do | |
action [:enable, :start] | |
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
bundle install --path /var/lib/jenkins/support/vendor | |
bundle exec strainer test |
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 'spec_helper' | |
# Replace USERNAME with your username! | |
describe 'USERNAME-myface::default' do | |
let(:chef_run) do | |
run = ChefSpec::ChefRunner.new(platform: 'ubuntu', version: '12.04') | |
run.converge('USERNAME-myface::default') | |
end | |
it 'installs apache2' do | |
expect(chef_run).to install_package('apache2') | |
end | |
it 'starts the apache2 service' do | |
expect(chef_run).to start_service('apache2') | |
end | |
it 'sets apache2 to start on boot' do | |
expect(chef_run).to set_service_to_start_on_boot 'apache2' | |
end | |
it 'creates the default template' do | |
expect(chef_run).to create_file('/var/www/index.html') | |
end | |
it 'creates the site with the correct content' do | |
template = chef_run.template('/var/www/index.html') | |
expect(template.owner).to eq('root') | |
expect(template.group).to eq('root') | |
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
package 'apache2' | |
service 'apache2' do | |
action [:enable, :start] | |
end | |
template '/var/www/index.html' do | |
owner 'root' | |
group 'root' | |
mode '0755' | |
source 'index.html.erb' | |
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
<html> | |
<head> | |
<title>Welcome to <%= node['fqdn'] %></title> | |
</head> | |
<body> | |
<p>Here's everything you need to know about <%= node['fqdn'] %>:</p> | |
<pre><%= JSON.pretty_generate(node.to_hash) %></pre> | |
</body> | |
</html> |
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
--- | |
driver_plugin: lxc | |
driver_config: | |
use_sudo: true | |
platforms: | |
- name: ubuntu-12.04 | |
driver_config: | |
base_container: ubuntu_12.04 | |
username: ubuntu | |
password: ubuntu | |
suites: | |
- name: default | |
run_list: ["recipe[myface]"] | |
attributes: {} |
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
knife: bundle exec knife cookbook test $COOKBOOK | |
foodcritic: bundle exec foodcritic $SANDBOX/$COOKBOOK -f any | |
rspec: (cd $COOKBOOK && bundle exec rspec --color --format documentation) | |
kitchen: (cd $COOKBOOK && bundle exec kitchen test) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment