From e5b9f4975cdec00fdbf3317244a4ad9a22e412d0 Mon Sep 17 00:00:00 2001 From: Niklaus Hofer Date: Sun, 26 Sep 2021 22:28:23 +0200 Subject: [PATCH] fixup! So that's how this works... --- spec/classes/prosody_spec.rb | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/spec/classes/prosody_spec.rb b/spec/classes/prosody_spec.rb index 13f93fa..54f7f5e 100644 --- a/spec/classes/prosody_spec.rb +++ b/spec/classes/prosody_spec.rb @@ -7,10 +7,6 @@ os_facts end - config_directory = case facts[:osfamily] - when 'Gentoo' then '/etc/jabber' - else '/etc/prosody' - end context 'on every platform' do it { is_expected.to contain_class 'prosody::package' } @@ -18,8 +14,20 @@ it { is_expected.to contain_class 'prosody::service' } it { is_expected.to contain_package('prosody').with(ensure: 'present') } - it { is_expected.to contain_file("#{config_directory}/conf.a'ail").with(ensure: 'directory') } - it { is_expected.to contain_file("#{config_directory}/conf.d").with(ensure: 'directory') } + it { + config_directory = case facts[:osfamily] + when 'Gentoo' then '/etc/jabber' + else '/etc/prosody' + end + is_expected.to contain_file("#{config_directory}/conf.a'ail").with(ensure: 'directory') + } + it { + config_directory = case facts[:osfamily] + when 'Gentoo' then '/etc/jabber' + else '/etc/prosody' + end + is_expected.to contain_file("#{config_directory}/conf.d").with(ensure: 'directory') + } end context 'with daemonize => true' do @@ -46,6 +54,10 @@ let(:params) { { custom_options: { 'foo' => 'bar', 'baz' => 'quux' } } } it { + config_directory = case facts[:osfamily] + when 'Gentoo' then '/etc/jabber' + else '/etc/prosody' + end is_expected.to contain_file("#{config_directory}/prosody.cfg.lua"). \ with_content(%r{^foo = "bar"$}, %r{^baz = "quux"$}) } @@ -55,6 +67,10 @@ let(:params) { { custom_options: { 'foo' => { 'fnord' => '23', 'xyzzy' => '42' }, 'bar' => %w[cool elements], 'baz' => 'quux' } } } it { + config_directory = case facts[:osfamily] + when 'Gentoo' then '/etc/jabber' + else '/etc/prosody' + end is_expected.to contain_file("#{config_directory}/prosody.cfg.lua"). \ with_content(%r{^foo = {\n fnord = "23";\n xyzzy = "42";\n}$}, %r{^baz = "quux"$}, %r{^bar = [ "cool"; "elements" ]$}) }