diff options
author | R.I.Pienaar <rip@devco.net> | 2012-08-30 02:11:02 -0700 |
---|---|---|
committer | R.I.Pienaar <rip@devco.net> | 2012-08-30 02:11:02 -0700 |
commit | 7490f60302f0187d306c594d68b30a6d75bc18c8 (patch) | |
tree | d28f03e5ccf3fb4888a166ee20d527561f54ba2f /spec/defines/init_spec.rb | |
parent | 00259779effdd210b7ad7b3e35551ddadd37116e (diff) | |
parent | 6a0c1f9a393ff293d4c21e11851001c86ba82ef4 (diff) | |
download | puppet-concat-7490f60302f0187d306c594d68b30a6d75bc18c8.tar.gz puppet-concat-7490f60302f0187d306c594d68b30a6d75bc18c8.tar.bz2 |
Merge pull request #31 from UnifiedPost/develop
Allow using a custom name and provide a path to the file that needs to be created using concat.
Diffstat (limited to 'spec/defines/init_spec.rb')
-rw-r--r-- | spec/defines/init_spec.rb | 60 |
1 files changed, 59 insertions, 1 deletions
diff --git a/spec/defines/init_spec.rb b/spec/defines/init_spec.rb index 34fb24b..172929a 100644 --- a/spec/defines/init_spec.rb +++ b/spec/defines/init_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe 'concat' do basedir = '/var/lib/puppet/concat' let(:title) { '/etc/foo.bar' } - let(:facts) { { + let(:facts) { { :concat_basedir => '/var/lib/puppet/concat', :id => 'root', } } @@ -54,4 +54,62 @@ describe 'concat' do end end +describe 'concat' do + + basedir = '/var/lib/puppet/concat' + let(:title) { 'foobar' } + let(:target) { '/etc/foo.bar' } + let(:facts) { { + :concat_basedir => '/var/lib/puppet/concat', + :id => 'root', + } } + let :pre_condition do + 'include concat::setup' + end + + directories = [ + "#{basedir}/foobar", + "#{basedir}/foobar/fragments", + ] + + directories.each do |dirs| + it do + should contain_file(dirs).with({ + 'ensure' => 'directory', + 'backup' => 'puppet', + 'group' => 0, + 'mode' => '0644', + 'owner' => 'root', + }) + end + end + + files = [ + "foobar", + "#{basedir}/foobar/fragments.concat", + ] + + files.each do |file| + it do + should contain_file(file).with({ + 'ensure' => 'present', + 'backup' => 'puppet', + 'group' => 0, + 'mode' => '0644', + 'owner' => 'root', + }) + end + end + + it do + should contain_exec("concat_foobar").with_command( + "#{basedir}/bin/concatfragments.sh " + + "-o #{basedir}/foobar/fragments.concat.out " + + "-d #{basedir}/foobar " + ) + end + + +end + # vim:sw=2:ts=2:expandtab:textwidth=79 |