Skip to content

Instantly share code, notes, and snippets.

@luksi1
Created August 12, 2019 16:50
Show Gist options
  • Save luksi1/507175be6bc6c790dfb38c02516a51a0 to your computer and use it in GitHub Desktop.
Save luksi1/507175be6bc6c790dfb38c02516a51a0 to your computer and use it in GitHub Desktop.
Testing a template with rspec-puppet
require 'spec_helper'
describe 'foo' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }
describe 'foo equals bar' do
let(:pre_condition) do
'class {"::foo":
foo => "bar",
}'
end
it { is_expected.to compile }
it { is_expected.to contain_file('/etc/foo.yml') }
it {
yml_file_content = "---
foo: bar
"
is_expected.to contain_file('/etc/foo.yml').with(
content: yml_file_content,
)
}
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment