]> gitweb.fluxo.info Git - puppet-stdlib.git/commitdiff
Added acceptance test and updated readme
authorHelen Campbell <helen@puppetlabs.com>
Mon, 28 Sep 2015 15:18:56 +0000 (16:18 +0100)
committerHelen Campbell <helen@puppetlabs.com>
Mon, 28 Sep 2015 15:18:56 +0000 (16:18 +0100)
README.markdown
spec/acceptance/empty_spec.rb

index f91932365f927d5cf331f321a1b27a402f8a625b..d023f2312cf978a4a581b19f857c1fe01810823a 100644 (file)
@@ -224,7 +224,7 @@ Converts the case of a string or of all strings in an array to lowercase. *Type*
 
 #### `empty`
 
-Returns true if the argument is an array or hash that contains no elements, or an empty string. *Type*: rvalue.
+Returns true if the argument is an array or hash that contains no elements, or an empty string. Returns false when the argument is a numerical value. *Type*: rvalue.
 
 #### `ensure_packages`
 
index 8b46aacdad875d11eb194a851211a9411341287f..2d4df901b4a0080adf85fe3b60d799f35b62ce52 100755 (executable)
@@ -27,6 +27,20 @@ describe 'empty function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('opera
       }
       EOS
 
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
+    end
+    it 'handles numerical values' do
+      pp = <<-EOS
+      $a = 7
+      $b = false
+      $o = empty($a)
+      if $o == $b {
+        notify { 'output correct': }
+      }
+      EOS
+
       apply_manifest(pp, :catch_failures => true) do |r|
         expect(r.stdout).to match(/Notice: output correct/)
       end