Skip to content

Commit

Permalink
fixup! So that's how this works...
Browse files Browse the repository at this point in the history
  • Loading branch information
NiklausHofer committed Sep 26, 2021
1 parent e8b4bd7 commit e5b9f49
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions spec/classes/prosody_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,27 @@
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' }
it { is_expected.to contain_class 'prosody::config' }
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
Expand All @@ -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"$})
}
Expand All @@ -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" ]$})
}
Expand Down

0 comments on commit e5b9f49

Please sign in to comment.