diff --git a/spec/classes/tempest_spec.rb b/spec/classes/tempest_spec.rb index 7b0f868f..b5943610 100644 --- a/spec/classes/tempest_spec.rb +++ b/spec/classes/tempest_spec.rb @@ -298,53 +298,39 @@ describe 'tempest' do end end - - context 'on Debian platforms' do - let :facts do - { :osfamily => 'Debian' } - end - - let :platform_params do - { :dev_packages => ['python-dev', - 'libxslt1-dev', - 'libxml2-dev', - 'libssl-dev', - 'libffi-dev', - 'patch', - 'gcc' ] } - end - - it_behaves_like 'tempest' - end - - context 'on RedHat platforms' do - let :facts do - { :osfamily => 'RedHat', - :operatingsystemrelease => '7' } - end - - let :platform_params do - { :dev_packages => ['python-devel', - 'libxslt-devel', - 'libxml2-devel', - 'openssl-devel', - 'libffi-devel', - 'patch', - 'gcc' ] } - end - - it_behaves_like 'tempest' - it_behaves_like 'tempest with plugins packages' - end - - context 'unsupported operating system' do - describe 'tempest class without any parameters on Solaris/Nexenta' do - let :facts do - { :osfamily => 'Solaris', - :operatingsystem => 'Nexenta' } + 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({ + :concat_basedir => '/var/lib/puppet/concat', + :processorcount => 2 + })) + end + let(:platform_params) do + case facts[:osfamily] + when 'Debian' + { :dev_packages => ['python-dev', + 'libxslt1-dev', + 'libxml2-dev', + 'libssl-dev', + 'libffi-dev', + 'patch', + 'gcc' ] } + when 'RedHat' + { :dev_packages => ['python-devel', + 'libxslt-devel', + 'libxml2-devel', + 'openssl-devel', + 'libffi-devel', + 'patch', + 'gcc' ] } + end end - it { expect { is_expected.to contain_package('tempest') }.to raise_error(Puppet::Error, /Unsupported osfamily: Solaris operatingsystem: Nexenta/) } + it_behaves_like 'tempest' + it_behaves_like 'tempest with plugins packages' end end end diff --git a/spec/unit/puppet/provider/ruby_spec.rb b/spec/unit/puppet/provider/ruby_spec.rb index 35444bec..9f07e4fd 100644 --- a/spec/unit/puppet/provider/ruby_spec.rb +++ b/spec/unit/puppet/provider/ruby_spec.rb @@ -17,8 +17,8 @@ describe 'Providers' do end end - def validate_file(expected_content, tmpfile = tmpfile) - expect(File.read(tmpfile)).to eq(expected_content) + def validate_file(expected_content, file = tmpfile) + expect(File.read(file)).to eq(expected_content) end let(:glance_params) do