From b34c7dc4e4f99d37b7f07f4776d69d8fcd8efabc Mon Sep 17 00:00:00 2001 From: Max Wilhelm Date: Mon, 14 Aug 2017 17:56:33 +0200 Subject: [PATCH] use rspec-puppet-facts for fluentd_repo_yum_spec --- spec/classes/fluentd_repo_yum_spec.rb | 46 +++++++++++++++------------ 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/spec/classes/fluentd_repo_yum_spec.rb b/spec/classes/fluentd_repo_yum_spec.rb index ede083d..7bcd865 100644 --- a/spec/classes/fluentd_repo_yum_spec.rb +++ b/spec/classes/fluentd_repo_yum_spec.rb @@ -1,27 +1,33 @@ require 'spec_helper' describe 'fluentd::repo::yum', :type => :class do - let(:facts) { - { - :osfamily => 'RedHat', - } - } + on_supported_os.each do |os, facts| + context "on #{os}" do + let :facts do + facts + end - describe 'when called with no parameters on RedHat' do - it { - should contain_yumrepo('treasure-data').with({ - 'ensure' => 'present', - 'baseurl' => 'https://packages.treasuredata.com/2/redhat/$releasever/$basearch', - 'descr' => 'TreasureData', - 'enabled' => '1', - 'gpgcheck' => '1' - }).that_notifies('Exec[add GPG key]') - should contain_exec('add GPG key').with({ - 'command' => 'rpm --import https://packages.treasuredata.com/GPG-KEY-td-agent', - 'path' => '/bin:/usr/bin/', - 'refreshonly' => 'true' - }) - } + describe 'when called with no parameters' do + case facts[:osfamily] + when 'RedHat' + it { + should contain_yumrepo('treasure-data').with({ + 'ensure' => 'present', + 'baseurl' => 'https://packages.treasuredata.com/2/redhat/$releasever/$basearch', + 'descr' => 'TreasureData', + 'enabled' => '1', + 'gpgcheck' => '1' + }).that_notifies('Exec[add GPG key]') + + should contain_exec('add GPG key').with({ + 'command' => 'rpm --import https://packages.treasuredata.com/GPG-KEY-td-agent', + 'path' => '/bin:/usr/bin/', + 'refreshonly' => 'true' + }) + } + end + end + end end end