Convert spec testing to rspec-puppet-facts

Change-Id: Ifd8b0ceaf9649ecf47db52382369516cacb6eb51
This commit is contained in:
Tobias Urdin 2018-11-08 10:40:24 +01:00
parent cd748c715f
commit f8d0d28760
1 changed files with 25 additions and 12 deletions

View File

@ -1,9 +1,9 @@
require 'spec_helper'
describe 'ec2api::config' do
let :params do
{ :ec2api_config => {
{
:ec2api_config => {
'DEFAULT/foo' => { 'value' => 'fooValue' },
'DEFAULT/bar' => { 'value' => 'barValue' },
'DEFAULT/baz' => { 'ensure' => 'absent' }
@ -16,18 +16,31 @@ describe 'ec2api::config' do
}
end
it { is_expected.to contain_class('ec2api::deps') }
shared_examples 'ec2api::config' do
it { should contain_class('ec2api::deps') }
it 'configures arbitrary ec2api configurations' do
is_expected.to contain_ec2api_config('DEFAULT/foo').with_value('fooValue')
is_expected.to contain_ec2api_config('DEFAULT/bar').with_value('barValue')
is_expected.to contain_ec2api_config('DEFAULT/baz').with_ensure('absent')
it {
should contain_ec2api_config('DEFAULT/foo').with_value('fooValue')
should contain_ec2api_config('DEFAULT/bar').with_value('barValue')
should contain_ec2api_config('DEFAULT/baz').with_ensure('absent')
}
it {
should contain_ec2api_api_paste_ini('DEFAULT/foo2').with_value('fooValue')
should contain_ec2api_api_paste_ini('DEFAULT/bar2').with_value('barValue')
should contain_ec2api_api_paste_ini('DEFAULT/baz2').with_ensure('absent')
}
end
it 'configures arbitrary ec2api-api-paste configurations' do
is_expected.to contain_ec2api_api_paste_ini('DEFAULT/foo2').with_value('fooValue')
is_expected.to contain_ec2api_api_paste_ini('DEFAULT/bar2').with_value('barValue')
is_expected.to contain_ec2api_api_paste_ini('DEFAULT/baz2').with_ensure('absent')
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
it_behaves_like 'ec2api::config'
end
end
end