diff options
Diffstat (limited to 'spec/defines/tftp_file_spec.rb')
-rw-r--r-- | spec/defines/tftp_file_spec.rb | 153 |
1 files changed, 88 insertions, 65 deletions
diff --git a/spec/defines/tftp_file_spec.rb b/spec/defines/tftp_file_spec.rb index 0de1b6f..e24f0f3 100644 --- a/spec/defines/tftp_file_spec.rb +++ b/spec/defines/tftp_file_spec.rb @@ -6,30 +6,36 @@ describe 'tftp::file' do describe 'when deploying on debian' do let(:facts) { { :operatingsystem => 'Debian', + :osfamily => 'Debian', :path => '/usr/local/bin:/usr/bin:/bin', } } - it { should include_class('tftp') } - it { should contain_file('/srv/tftp/sample').with({ - 'ensure' => 'file', - 'owner' => 'tftp', - 'group' => 'tftp', - 'mode' => '0644', - 'recurse' => false, - }) } + it { + should include_class('tftp') + should contain_file('/srv/tftp/sample').with({ + 'ensure' => 'file', + 'owner' => 'tftp', + 'group' => 'tftp', + 'mode' => '0644', + 'recurse' => false, + }) + } end describe 'when deploying on ubuntu' do let(:facts) { { :operatingsystem => 'ubuntu', + :osfamily => 'Debian', :path => '/usr/local/bin:/usr/bin:/bin', } } - it { should include_class('tftp') } - it { should contain_file('/var/lib/tftpboot/sample').with({ - 'ensure' => 'file', - 'owner' => 'tftp', - 'group' => 'tftp', - 'mode' => '0644', - 'recurse' => false, - }) } + it { + should include_class('tftp') + should contain_file('/var/lib/tftpboot/sample').with({ + 'ensure' => 'file', + 'owner' => 'tftp', + 'group' => 'tftp', + 'mode' => '0644', + 'recurse' => false, + }) + } end describe 'when deploying with parameters' do @@ -39,30 +45,36 @@ describe 'tftp::file' do :mode => '0755', :recurse => true }} let(:facts) { { :operatingsystem => 'Debian', + :osfamily => 'Debian', :path => '/usr/local/bin:/usr/bin:/bin', } } - it { should include_class('tftp') } - it { should contain_file('/srv/tftp/sample').with({ - 'ensure' => 'directory', - 'owner' => 'root', - 'group' => 'root', - 'mode' => '0755', - 'recurse' => true, - }) } + it { + should include_class('tftp') + should contain_file('/srv/tftp/sample').with({ + 'ensure' => 'directory', + 'owner' => 'root', + 'group' => 'root', + 'mode' => '0755', + 'recurse' => true, + }) + } end describe 'when deploying without recurse parameters' do let(:facts) { {:operatingsystem => 'Debian', + :osfamily => 'Debian', :path => '/usr/local/bin:/usr/bin:/bin', } } - it { should include_class('tftp') } - it { should contain_file('/srv/tftp/sample').with({ - 'ensure' => 'file', - 'recurse' => false, - 'purge' => nil, - 'replace' => nil, - 'recurselimit' => nil, - }) } + it { + should include_class('tftp') + should contain_file('/srv/tftp/sample').with({ + 'ensure' => 'file', + 'recurse' => false, + 'purge' => nil, + 'replace' => nil, + 'recurselimit' => nil, + }) + } end describe 'when deploying with recurse parameters' do @@ -73,49 +85,57 @@ describe 'tftp::file' do :purge => true, :replace => false }} let(:facts) { {:operatingsystem => 'Debian', + :osfamily => 'Debian', :path => '/usr/local/bin:/usr/bin:/bin', }} - it { should include_class('tftp') } - it { should contain_file('/srv/tftp/sample').with({ - 'ensure' => 'directory', - 'owner' => 'tftp', - 'group' => 'tftp', - 'mode' => '0755', - 'recurse' => true, - 'recurselimit' => 42, - 'purge' => true, - 'replace' => false, - }) } + it { + should include_class('tftp') + should contain_file('/srv/tftp/sample').with({ + 'ensure' => 'directory', + 'owner' => 'tftp', + 'group' => 'tftp', + 'mode' => '0755', + 'recurse' => true, + 'recurselimit' => 42, + 'purge' => true, + 'replace' => false, + }) + } end describe 'when deploying directory' do let(:params) { {:ensure => 'directory', :mode => '0755' }} let(:facts) { { :operatingsystem => 'Debian', + :osfamily => 'Debian', :caller_module_name => 'acme', :path => '/usr/local/bin:/usr/bin:/bin', } } - it { should include_class('tftp') } - it { should contain_file('/srv/tftp/sample').with({ - 'ensure' => 'directory', - 'mode' => '0755', - 'source' => nil, - }) } + it { + should include_class('tftp') + should contain_file('/srv/tftp/sample').with({ + 'ensure' => 'directory', + 'mode' => '0755', + 'source' => nil, + }) + } end - describe 'when deploying file from another module' do + describe 'when deploying file' do let(:params) { {:ensure => 'file', :mode => '0755' }} let(:facts) { { :operatingsystem => 'Debian', - :caller_module_name => 'acme', + :osfamily => 'Debian', :path => '/usr/local/bin:/usr/bin:/bin', } } - it { should include_class('tftp') } - it { should contain_file('/srv/tftp/sample').with({ - 'ensure' => 'file', - 'mode' => '0755', - 'source' => 'puppet:///modules/acme/sample' - }) } + it { + should include_class('tftp') + should contain_file('/srv/tftp/sample').with({ + 'ensure' => 'file', + 'mode' => '0755', + 'source' => 'puppet:///modules/tftp/sample' + }) + } end describe 'when deploying file with content' do @@ -123,15 +143,18 @@ describe 'tftp::file' do :content => 'hi', :mode => '0755' }} let(:facts) { { :operatingsystem => 'Debian', + :osfamily => 'Debian', :caller_module_name => 'acme', :path => '/usr/local/bin:/usr/bin:/bin', } } - - it { should include_class('tftp') } - it { should contain_file('/srv/tftp/sample').with({ - 'ensure' => 'file', - 'mode' => '0755', - 'content' => 'hi', - 'source' => nil, - }) } + it { + should include_class('tftp') + should contain_file('/srv/tftp/sample').with({ + 'ensure' => 'file', + 'mode' => '0755', + 'content' => 'hi', + 'source' => nil, + }) + } end + end |