]> gitweb.fluxo.info Git - puppet-tftp.git/commitdiff
Add spec tests for recurse params.
authorThomas Van Doren <thomas.vandoren@gmail.com>
Sat, 16 Jun 2012 02:34:53 +0000 (19:34 -0700)
committerThomas Van Doren <thomas.vandoren@gmail.com>
Sat, 16 Jun 2012 02:34:53 +0000 (19:34 -0700)
One test verifies the defaults for recurse, purge, replace, recurselimit when they are not provided. The other test ensure that setting them in the tftp:file definition correlates to the params getting set on the file.

spec/defines/tftp_file_spec.rb

index 8caa65ba6d0dd5443235d4fbb2bfbb6b15bb65f7..6a032c0cc944625bcd5d3413a1fae5a9bebbcfee 100644 (file)
@@ -50,4 +50,41 @@ describe 'tftp::file' do
       'mode'    => '0755'
     }) }
   end
+
+  describe 'when deploying without recurse parameters' do
+    let(:facts) { {:operatingsystem => '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
+    }) }
+  end
+
+  describe 'when deploying with recurse parameters' do
+    let(:params) { {:ensure       => 'directory',
+                    :recurse      => true,
+                    :mode         => '0755',
+                    :recurselimit => 42,
+                    :purge        => true,
+                    :replace      => false }}
+    let(:facts) { {:operatingsystem => 'Debian',
+                   :path            => '/usr/local/bin:/usr/bin:/bin', }}
+
+    it { should include_class('tftp') }
+    it { should contain_file('/srv/tftp/sample').with({
+      'ensure'       => 'directory',
+      'recurse'      => true,
+      'owner'        => 'tftp',
+      'group'        => 'tftp',
+      'mode'         => '0755',
+      'recurselimit' => 42,
+      'purge'        => true,
+      'replace'      => false,
+    }) }
+  end
 end