]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/concat/spec/defines/init_spec.rb
172929abf2e51edb82bd115e9d872bd06705b041
[dsa-puppet.git] / modules / concat / spec / defines / init_spec.rb
1 require 'spec_helper'
2
3 describe 'concat' do
4   basedir = '/var/lib/puppet/concat'
5   let(:title) { '/etc/foo.bar' }
6   let(:facts) { {
7     :concat_basedir => '/var/lib/puppet/concat',
8     :id             => 'root',
9   } }
10   let :pre_condition do
11     'include concat::setup'
12   end
13
14   directories = [
15     "#{basedir}/_etc_foo.bar",
16     "#{basedir}/_etc_foo.bar/fragments",
17   ]
18
19   directories.each do |dirs|
20     it do
21       should contain_file(dirs).with({
22         'ensure'  => 'directory',
23         'backup'  => 'puppet',
24         'group'   => 0,
25         'mode'    => '0644',
26         'owner'   => 'root',
27       })
28     end
29   end
30
31   files = [
32     "/etc/foo.bar",
33     "#{basedir}/_etc_foo.bar/fragments.concat",
34   ]
35
36   files.each do |file|
37     it do
38       should contain_file(file).with({
39         'ensure'  => 'present',
40         'backup'  => 'puppet',
41         'group'   => 0,
42         'mode'    => '0644',
43         'owner'   => 'root',
44       })
45     end
46   end
47
48   it do
49     should contain_exec("concat_/etc/foo.bar").with_command(
50       "#{basedir}/bin/concatfragments.sh " +
51       "-o #{basedir}/_etc_foo.bar/fragments.concat.out " +
52       "-d #{basedir}/_etc_foo.bar   "
53     )
54   end
55 end
56
57 describe 'concat' do
58
59   basedir = '/var/lib/puppet/concat'
60   let(:title) { 'foobar' }
61   let(:target) { '/etc/foo.bar' }
62   let(:facts) { {
63     :concat_basedir => '/var/lib/puppet/concat',
64     :id             => 'root',
65   } }
66   let :pre_condition do
67     'include concat::setup'
68   end
69
70   directories = [
71     "#{basedir}/foobar",
72     "#{basedir}/foobar/fragments",
73   ]
74
75   directories.each do |dirs|
76     it do
77       should contain_file(dirs).with({
78         'ensure'  => 'directory',
79         'backup'  => 'puppet',
80         'group'   => 0,
81         'mode'    => '0644',
82         'owner'   => 'root',
83       })
84     end
85   end
86
87   files = [
88     "foobar",
89     "#{basedir}/foobar/fragments.concat",
90   ]
91
92   files.each do |file|
93     it do
94       should contain_file(file).with({
95         'ensure'  => 'present',
96         'backup'  => 'puppet',
97         'group'   => 0,
98         'mode'    => '0644',
99         'owner'   => 'root',
100       })
101     end
102   end
103
104   it do
105     should contain_exec("concat_foobar").with_command(
106       "#{basedir}/bin/concatfragments.sh " +
107       "-o #{basedir}/foobar/fragments.concat.out " +
108       "-d #{basedir}/foobar   "
109     )
110   end
111
112
113 end
114
115 # vim:sw=2:ts=2:expandtab:textwidth=79