From 166263b2c85edcd309eb2081f97146c1b1f74fc3 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 30 Jan 2024 22:26:49 +0100 Subject: [PATCH] refactor default spec test --- spec/defines/generate_concat_spec.rb | 30 ++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/spec/defines/generate_concat_spec.rb b/spec/defines/generate_concat_spec.rb index 4d0abe30..02ff9e9e 100644 --- a/spec/defines/generate_concat_spec.rb +++ b/spec/defines/generate_concat_spec.rb @@ -3,17 +3,27 @@ require 'spec_helper' describe 'Rsyslog::Generate_concat', include_rsyslog: true do - let(:pre_condition) { 'include rsyslog' } - let(:title) { 'mygeneratedconcat' } + context 'default' do + let(:pre_condition) { 'include rsyslog' } + let(:title) { 'mygeneratedconcat' } - let(:params) do - { - confdir: '/etc/rsyslog.d', - target: '50-rsyslog.conf' - } - end + on_supported_os.each do |os, os_facts| + context "on #{os}" do + let :facts do + os_facts + end + + let(:params) do + { + confdir: '/etc/rsyslog.d', + target: '50-rsyslog.conf' + } + end - context 'with defaults' do - it { is_expected.to contain_concat('/etc/rsyslog.d/50-rsyslog.conf').that_notifies('Service[rsyslog]') } + it 'contains rsyslog config with syslog service notification' do + is_expected.to contain_concat('/etc/rsyslog.d/50-rsyslog.conf').that_notifies('Service[rsyslog]') + end + end + end end end