Add the prosody module
[mirror/dsa-puppet.git] / 3rdparty / modules / prosody / spec / classes / prosody_spec.rb
1 require 'spec_helper'
2
3 describe 'prosody' do
4   let(:facts) do
5     { osfamily: 'SomeOS' }
6   end
7   context 'on every platform' do
8     it { should contain_class 'prosody::package' }
9     it { should contain_class 'prosody::config' }
10     it { should contain_class 'prosody::service' }
11
12     it { should contain_package('prosody').with(ensure: 'present') }
13   end
14
15   context 'with daemonize => true' do
16     let(:params) { { daemonize: true } }
17     it {
18       should contain_service('prosody').with(
19         ensure: 'running'
20       )
21     }
22   end
23
24   context 'with daemonize => false' do
25     let(:params) { { daemonize: false } }
26     it {
27       should_not contain_service('prosody').with(
28         ensure: 'running'
29       )
30     }
31   end
32
33   context 'with custom options' do
34     let(:params) { { custom_options: { 'foo' => 'bar', 'baz' => 'quux' } } }
35     it {
36       should contain_file('/etc/prosody/prosody.cfg.lua') \
37         .with_content(/^foo = "bar"$/, /^baz = "quux"$/)
38     }
39   end
40
41   context 'with deeply nested custom options' do
42     let(:params) { { custom_options: { 'foo' => { 'fnord' => '23', 'xyzzy' => '42' }, 'bar' => %w[cool elements], 'baz' => 'quux' } } }
43     it {
44       should contain_file('/etc/prosody/prosody.cfg.lua') \
45         .with_content(/^foo = {\n  fnord = "23";\n  xyzzy = "42";\n}$/, /^baz = "quux"$/, /^bar = [ "cool"; "elements" ]$/)
46     }
47   end
48 end