Skip to content

Instantly share code, notes, and snippets.

@Kgirthofer
Last active August 25, 2016 13:50
Show Gist options
  • Save Kgirthofer/27a2233969c1e7e4a98251dd2fe9e17a to your computer and use it in GitHub Desktop.
Save Kgirthofer/27a2233969c1e7e4a98251dd2fe9e17a to your computer and use it in GitHub Desktop.
describe 'certs::default' do
cached(:chef_run) { default_chef_run }
subject { chef_run }
before :each do
stub_command(/.*/).and_return true
# need to stub out a data bag? see .kitchen.yml too.
allow(Chef::EncryptedDataBagItem).to receive(:load).and_return 'stuff'
end
describe 'included recipies' do
it { is_expected.to include_recipe 'certs::ssl' }
end
end
__________________________________________________________
require 'spec_helper'
require 'rspec/expectations'
describe 'certs::ssl' do
subject { chef_run }
context "run" do
cached(:chef_run) do
ChefSpec::ServerRunner.new(
platform: 'amazon',
version: '2015.09') do |node|
end.converge(described_recipe)
end
before :each do
stub_command(/.*/).and_return true
allow(Chef::EncryptedDataBagItem).to receive(:load).and_return(
'wildcard_cert' => {}
)
end
describe 'directories' do
it { is_expected.to create_directory('/etc/ssl') }
end
describe 'tempaltes' do
it { is_expected.to create_template('/etc/ssl/mysite.key') }
it { is_expected.to create_template('/etc/ssl/mysite_chain.crt') }
it { is_expected.to create_template('/etc/ssl/mysite.crt') }
end
end
end
~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment