Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce support for Gentoo #79

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
8 changes: 4 additions & 4 deletions spec/classes/prosody_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
it { is_expected.to contain_class 'prosody::service' }

it { is_expected.to contain_package('prosody').with(ensure: 'present') }
it { is_expected.to contain_file('/etc/prosody/conf.avail').with(ensure: 'directory') }
it { is_expected.to contain_file('/etc/prosody/conf.d').with(ensure: 'directory') }
it { is_expected.to contain_file("#{prosody::config_directory}/conf.a'ail").with(ensure: 'directory') }
it { is_expected.to contain_file("#{prosody::config_directory}/conf.d").with(ensure: 'directory') }
smortex marked this conversation as resolved.
Show resolved Hide resolved
end

context 'with daemonize => true' do
Expand All @@ -41,7 +41,7 @@
let(:params) { { custom_options: { 'foo' => 'bar', 'baz' => 'quux' } } }

it {
is_expected.to contain_file('/etc/prosody/prosody.cfg.lua'). \
is_expected.to contain_file("#{prosody::config_directory}/prosody.cfg.lua"). \
with_content(%r{^foo = "bar"$}, %r{^baz = "quux"$})
}
end
Expand All @@ -50,7 +50,7 @@
let(:params) { { custom_options: { 'foo' => { 'fnord' => '23', 'xyzzy' => '42' }, 'bar' => %w[cool elements], 'baz' => 'quux' } } }

it {
is_expected.to contain_file('/etc/prosody/prosody.cfg.lua'). \
is_expected.to contain_file("#{prosody::config_directory}/prosody.cfg.lua"). \
with_content(%r{^foo = {\n fnord = "23";\n xyzzy = "42";\n}$}, %r{^baz = "quux"$}, %r{^bar = [ "cool"; "elements" ]$})
}
end
Expand Down
18 changes: 9 additions & 9 deletions spec/defines/virtualhost_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

let(:title) { 'mockvirtualhost' }

let(:path_avail) { "/etc/prosody/conf.avail/#{title}.cfg.lua" }
let(:path_link) { "/etc/prosody/conf.d/#{title}.cfg.lua" }
let(:path_avail) { "#{prosody::config_directory}/conf.avail/#{title}.cfg.lua" }
let(:path_link) { "#{prosody::config_directory}/conf.d/#{title}.cfg.lua" }

context 'with no parameters' do
it {
Expand All @@ -38,31 +38,31 @@
end

context 'with ssl_key but no ssl_cert' do
let(:params) { { ssl_key: '/etc/prosody/certs/rspec-puppet.com.key' } }
let(:params) { { ssl_key: "#{prosody::config_directory}/certs/rspec-puppet.com.key" } }

it { is_expected.to compile.and_raise_error(%r{The prosody::virtualhost type needs both ssl_key \*and\* ssl_cert set}) }
end

context 'with ssl_cert but no ssl_key' do
let(:params) { { ssl_cert: '/etc/prosody/certs/rspec-puppet.com.crt' } }
let(:params) { { ssl_cert: "#{prosody::config_directory}/certs/rspec-puppet.com.crt" } }

it { is_expected.to compile.and_raise_error(%r{The prosody::virtualhost type needs both ssl_key \*and\* ssl_cert set}) }
end

context 'with ssl keys and certs' do
let(:ssl_key) { '/etc/prosody/certs/rspec-puppet.com.key' }
let(:ssl_cert) { '/etc/prosody/certs/rspec-puppet.com.crt' }
let(:ssl_key) { "#{prosody::config_directory}/certs/rspec-puppet.com.key" }
let(:ssl_cert) { "#{prosody::config_directory}/certs/rspec-puppet.com.crt" }
let(:params) { { ssl_key: ssl_key, ssl_cert: ssl_cert } }

it {
# This require statment is bananas
is_expected.to contain_file(path_avail).with(
ensure: 'present',
require: ['File[/etc/prosody/certs/mockvirtualhost.key]', 'File[/etc/prosody/certs/mockvirtualhost.crt]', 'Class[Prosody::Package]']
require: ["File[#{prosody::config_directory}/certs/mockvirtualhost.key]", "File[#{prosody::config_directory}/certs/mockvirtualhost.crt]", 'Class[Prosody::Package]']
)

is_expected.to contain_file('/etc/prosody/certs/mockvirtualhost.key').with_source(ssl_key)
is_expected.to contain_file('/etc/prosody/certs/mockvirtualhost.crt').with_source(ssl_cert)
is_expected.to contain_file("#{prosody::config_directory}/certs/mockvirtualhost.key").with_source(ssl_key)
is_expected.to contain_file("#{prosody::config_directory}/certs/mockvirtualhost.crt").with_source(ssl_cert)
}
end

Expand Down