Last active
December 11, 2016 15:54
-
-
Save nandotorres/36c18b5e020c2ac6db5aa8dc5d472149 to your computer and use it in GitHub Desktop.
Specs for cookbook unit tests
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' | |
describe 'techtalk::default' do | |
context 'When applying cookbooks on an Ubuntu instance' do | |
let(:chef_run) do | |
runner = ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04') | |
runner.converge(described_recipe) | |
end | |
it 'install docker' do | |
expect(chef_run).to run_execute('install docker') | |
.with(command: 'curl -sSL https://get.docker.com/ | sh') | |
end | |
it 'restart docker service' do | |
expect(chef_run).to run_execute('restart docker service') | |
.with(command: 'sudo service docker restart') | |
end | |
it 'run application container' do | |
expect(chef_run).to run_execute('run application container') | |
.with(command: | |
'docker run -d -p 80:3000 --restart=always nandotorres/mean-todo') | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment