]> gitweb.fluxo.info Git - puppet-stdlib.git/commitdiff
Add success/fail groups
authorHunter Haugen <hunter@puppetlabs.com>
Tue, 8 Apr 2014 22:04:55 +0000 (15:04 -0700)
committerHunter Haugen <hunter@puppetlabs.com>
Tue, 8 Apr 2014 22:04:55 +0000 (15:04 -0700)
16 files changed:
Gemfile
spec/acceptance/abs_spec.rb
spec/acceptance/any2array_spec.rb
spec/acceptance/base64_spec.rb
spec/acceptance/bool2num_spec.rb
spec/acceptance/capitalize_spec.rb
spec/acceptance/chomp_spec.rb
spec/acceptance/chop_spec.rb
spec/acceptance/concat_spec.rb
spec/acceptance/count_spec.rb
spec/acceptance/deep_merge_spec.rb
spec/acceptance/defined_with_params_spec.rb
spec/acceptance/delete_at_spec.rb
spec/acceptance/delete_spec.rb
spec/acceptance/delete_undef_values_spec.rb
spec/acceptance/num2bool_spec.rb [new file with mode: 0644]

diff --git a/Gemfile b/Gemfile
index eb5a31c7618489d68453581fce7eca80166295d4..bbef720351c22de5eeb2909a7ade981c461b1d86 100644 (file)
--- a/Gemfile
+++ b/Gemfile
@@ -14,9 +14,6 @@ group :development, :test do
   gem 'rake', '~> 10.1.0',       :require => false
   gem 'rspec-puppet',            :require => false
   gem 'puppetlabs_spec_helper',  :require => false
-  gem 'rspec-system',            :require => false
-  gem 'rspec-system-puppet',     :require => false
-  gem 'rspec-system-serverspec', :require => false
   gem 'serverspec',              :require => false
   gem 'puppet-lint',             :require => false
   gem 'pry',                     :require => false
index 0921497afe5d562b3340fc99cb3ad8f9f264c531..eeae89b0dda5480f631c1f48ad957bb374bf4bc1 100644 (file)
@@ -1,27 +1,29 @@
 require 'spec_helper_acceptance'
 
 describe 'abs function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
-  it 'should accept a string' do
-    pp = <<-EOS
-    $input  = '-34.56'
-    $output = abs($input)
-    notify { $output: }
-    EOS
+  describe 'success' do
+    it 'should accept a string' do
+      pp = <<-EOS
+      $input  = '-34.56'
+      $output = abs($input)
+      notify { $output: }
+      EOS
 
-    apply_manifest(pp, :catch_failures => true) do |r|
-      expect(r.stdout).to match(/Notice: 34.56/)
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: 34.56/)
+      end
     end
-  end
 
-  it 'should accept a float' do
-    pp = <<-EOS
-    $input  = -34.56
-    $output = abs($input)
-    notify { $output: }
-    EOS
+    it 'should accept a float' do
+      pp = <<-EOS
+      $input  = -34.56
+      $output = abs($input)
+      notify { $output: }
+      EOS
 
-    apply_manifest(pp, :catch_failures => true) do |r|
-      expect(r.stdout).to match(/Notice: 34.56/)
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: 34.56/)
+      end
     end
   end
 end
index 7d452edbd76ad52ba25e6dba155c7c510df06f97..0127303a722d321d705af7d5517198d6d8c7bbc4 100644 (file)
@@ -1,46 +1,48 @@
 require 'spec_helper_acceptance'
 
 describe 'any2array function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
-  it 'should create an empty array' do
-    pp = <<-EOS
-    $input = ''
-    $output = any2array($input)
-    validate_array($output)
-    notify { "Output: ${output}": }
-    EOS
+  describe 'success' do
+    it 'should create an empty array' do
+      pp = <<-EOS
+      $input = ''
+      $output = any2array($input)
+      validate_array($output)
+      notify { "Output: ${output}": }
+      EOS
 
-    apply_manifest(pp, :catch_failures => true) do |r|
-      expect(r.stdout).to match(/Notice: Output: /)
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: Output: /)
+      end
     end
-  end
 
-  it 'should leave arrays modified' do
-    pp = <<-EOS
-    $input = ['test', 'array']
-    $output = any2array($input)
-    validate_array($output)
-    notify { "Output: ${output}": }
-    EOS
+    it 'should leave arrays modified' do
+      pp = <<-EOS
+      $input = ['test', 'array']
+      $output = any2array($input)
+      validate_array($output)
+      notify { "Output: ${output}": }
+      EOS
 
-    apply_manifest(pp, :catch_failures => true) do |r|
-      expect(r.stdout).to match(/Notice: Output: testarray/)
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: Output: testarray/)
+      end
     end
-  end
 
-  it 'should turn a hash into an array' do
-    pp = <<-EOS
-    $input = {'test' => 'array'}
-    $output = any2array($input)
+    it 'should turn a hash into an array' do
+      pp = <<-EOS
+      $input = {'test' => 'array'}
+      $output = any2array($input)
 
-    validate_array($output)
-    # Check each element of the array is a plain string.
-    validate_string($output[0])
-    validate_string($output[1])
-    notify { "Output: ${output}": }
-    EOS
+      validate_array($output)
+      # Check each element of the array is a plain string.
+      validate_string($output[0])
+      validate_string($output[1])
+      notify { "Output: ${output}": }
+      EOS
 
-    apply_manifest(pp, :catch_failures => true) do |r|
-      expect(r.stdout).to match(/Notice: Output: testarray/)
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: Output: testarray/)
+      end
     end
   end
 end
index c29b3a714046b7febfd83e2cbf5e982b72d50610..30ba6894e97545648da9784c18e65f97130718d2 100644 (file)
@@ -1,15 +1,17 @@
 require 'spec_helper_acceptance'
 
 describe 'base64 function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
-  it 'should encode then decode a string' do
-    pp = <<-EOS
-    $encodestring = base64('encode', 'thestring')
-    $decodestring = base64('decode', $encodestring)
-    notify { $decodestring: }
-    EOS
+  describe 'success' do
+    it 'should encode then decode a string' do
+      pp = <<-EOS
+      $encodestring = base64('encode', 'thestring')
+      $decodestring = base64('decode', $encodestring)
+      notify { $decodestring: }
+      EOS
 
-    apply_manifest(pp, :catch_failures => true) do |r|
-      expect(r.stdout).to match(/thestring/)
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/thestring/)
+      end
     end
   end
 end
index 5bdb452b358677ef500ce90f6705688c29cbccbb..1cbd88dadf6ac31c5b2a8f90f343d4e99fd96841 100644 (file)
@@ -1,30 +1,32 @@
 require 'spec_helper_acceptance'
 
 describe 'bool2num function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
-  ['false', 'f', '0', 'n', 'no'].each do |bool|
-    it 'should convert a given boolean, #{bool}, to 0' do
-      pp = <<-EOS
-      $input = #{bool}
-      $output = bool2num($input)
-      notify { $output: }
-      EOS
+  describe 'success' do
+    ['false', 'f', '0', 'n', 'no'].each do |bool|
+      it 'should convert a given boolean, #{bool}, to 0' do
+        pp = <<-EOS
+        $input = #{bool}
+        $output = bool2num($input)
+        notify { $output: }
+        EOS
 
-      apply_manifest(pp, :catch_failures => true) do |r|
-        expect(r.stdout).to match(/Notice: 0/)
+        apply_manifest(pp, :catch_failures => true) do |r|
+          expect(r.stdout).to match(/Notice: 0/)
+        end
       end
     end
-  end
 
-  ['true', 't', '1', 'y', 'yes'].each do |bool|
-    it 'should convert a given boolean, #{bool}, to 1' do
-      pp = <<-EOS
-      $input = #{bool}
-      $output = bool2num($input)
-      notify { $output: }
-      EOS
+    ['true', 't', '1', 'y', 'yes'].each do |bool|
+      it 'should convert a given boolean, #{bool}, to 1' do
+        pp = <<-EOS
+        $input = #{bool}
+        $output = bool2num($input)
+        notify { $output: }
+        EOS
 
-      apply_manifest(pp, :catch_failures => true) do |r|
-        expect(r.stdout).to match(/Notice: 1/)
+        apply_manifest(pp, :catch_failures => true) do |r|
+          expect(r.stdout).to match(/Notice: 1/)
+        end
       end
     end
   end
index 41e16e975950a9ff28fc9bd25d0150eb3ee78a78..c04b4016b45c9589bd667d3a9fd2b2a846da0baf 100644 (file)
@@ -1,30 +1,32 @@
 require 'spec_helper_acceptance'
 
 describe 'capitalize function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
-  it 'should capitalize the first letter of a string' do
-    pp = <<-EOS
-    $input = 'this is a string'
-    $output = capitalize($input)
-    notify { $output: }
-    EOS
+  describe 'success' do
+    it 'should capitalize the first letter of a string' do
+      pp = <<-EOS
+      $input = 'this is a string'
+      $output = capitalize($input)
+      notify { $output: }
+      EOS
 
-    apply_manifest(pp, :catch_failures => true) do |r|
-      expect(r.stdout).to match(/Notice: This is a string/)
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: This is a string/)
+      end
     end
-  end
 
-  it 'should capitalize the first letter of an array of strings' do
-    pp = <<-EOS
-    $input = ['this', 'is', 'a', 'string']
-    $output = capitalize($input)
-    notify { $output: }
-    EOS
+    it 'should capitalize the first letter of an array of strings' do
+      pp = <<-EOS
+      $input = ['this', 'is', 'a', 'string']
+      $output = capitalize($input)
+      notify { $output: }
+      EOS
 
-    apply_manifest(pp, :catch_failures => true) do |r|
-      expect(r.stdout).to match(/Notice: This/)
-      expect(r.stdout).to match(/Notice: Is/)
-      expect(r.stdout).to match(/Notice: A/)
-      expect(r.stdout).to match(/Notice: String/)
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: This/)
+        expect(r.stdout).to match(/Notice: Is/)
+        expect(r.stdout).to match(/Notice: A/)
+        expect(r.stdout).to match(/Notice: String/)
+      end
     end
   end
 end
index 052226f53c3b3bf7280fde5d49a07f126d5b5fdf..c4af9d9f325bc92dc2968f7addc4f93252eb1b51 100644 (file)
@@ -1,18 +1,20 @@
 require 'spec_helper_acceptance'
 
 describe 'chomp function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
-  it 'should eat the newline' do
-    pp = <<-EOS
-    $input = "test\n"
-    if size($input) != 5 {
-      fail("Size of ${input} is not 5.")
-    }
-    $output = chomp($input)
-    if size($output) != 4 {
-      fail("Size of ${input} is not 4.")
-    }
-    EOS
+  describe 'success' do
+    it 'should eat the newline' do
+      pp = <<-EOS
+      $input = "test\n"
+      if size($input) != 5 {
+        fail("Size of ${input} is not 5.")
+      }
+      $output = chomp($input)
+      if size($output) != 4 {
+        fail("Size of ${input} is not 4.")
+      }
+      EOS
 
-    apply_manifest(pp, :catch_failures => true)
+      apply_manifest(pp, :catch_failures => true)
+    end
   end
 end
index f1183a1f24380b6901d0734b14cbbe85d9e4db95..87743901462381c94297d59f3eddd5b5188d9963 100644 (file)
@@ -1,42 +1,44 @@
 require 'spec_helper_acceptance'
 
 describe 'chop function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
-  it 'should eat the last character' do
-    pp = <<-EOS
-    $input = "test"
-    if size($input) != 4 {
-      fail("Size of ${input} is not 4.")
-    }
-    $output = chop($input)
-    if size($output) != 3 {
-      fail("Size of ${input} is not 3.")
-    }
-    EOS
+  describe 'success' do
+    it 'should eat the last character' do
+      pp = <<-EOS
+      $input = "test"
+      if size($input) != 4 {
+        fail("Size of ${input} is not 4.")
+      }
+      $output = chop($input)
+      if size($output) != 3 {
+        fail("Size of ${input} is not 3.")
+      }
+      EOS
 
-    apply_manifest(pp, :catch_failures => true)
-  end
+      apply_manifest(pp, :catch_failures => true)
+    end
 
-  it 'should eat the last two characters of \r\n' do
-    pp = <<-EOS
-    $input = "test\r\n"
-    if size($input) != 6 {
-      fail("Size of ${input} is not 6.")
-    }
-    $output = chop($input)
-    if size($output) != 4 {
-      fail("Size of ${input} is not 4.")
-    }
-    EOS
+    it 'should eat the last two characters of \r\n' do
+      pp = <<-EOS
+      $input = "test\r\n"
+      if size($input) != 6 {
+        fail("Size of ${input} is not 6.")
+      }
+      $output = chop($input)
+      if size($output) != 4 {
+        fail("Size of ${input} is not 4.")
+      }
+      EOS
 
-    apply_manifest(pp, :catch_failures => true)
-  end
+      apply_manifest(pp, :catch_failures => true)
+    end
 
-  it 'should not fail on empty strings' do
-    pp = <<-EOS
-    $input = ""
-    $output = chop($input)
-    EOS
+    it 'should not fail on empty strings' do
+      pp = <<-EOS
+      $input = ""
+      $output = chop($input)
+      EOS
 
-    apply_manifest(pp, :catch_failures => true)
+      apply_manifest(pp, :catch_failures => true)
+    end
   end
 end
index 1fe772996a7288aa48a8867aac0c91ba1eac7ca2..24b595540a1010b1765ddd66b0c4d5be0f6c8e8b 100644 (file)
@@ -1,15 +1,17 @@
 require 'spec_helper_acceptance'
 
 describe 'concat function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
-  it 'should concat one array to another' do
-    pp = <<-EOS
-    $output = concat(['1','2','3'],['4','5','6'])
-    validate_array($output)
-    if size($output) != 6 {
-      fail("${output} should have 6 elements.")
-    }
-    EOS
+  describe 'success' do
+    it 'should concat one array to another' do
+      pp = <<-EOS
+      $output = concat(['1','2','3'],['4','5','6'])
+      validate_array($output)
+      if size($output) != 6 {
+        fail("${output} should have 6 elements.")
+      }
+      EOS
 
-    apply_manifest(pp, :catch_failures => true)
+      apply_manifest(pp, :catch_failures => true)
+    end
   end
 end
index cc46be0b7596782fa72c0c0415d4a830960eb829..0a0f5d732c1da829734bc041d757dbd7956bf3be 100644 (file)
@@ -1,27 +1,29 @@
 require 'spec_helper_acceptance'
 
 describe 'count function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
-  it 'should count elements in an array' do
-    pp = <<-EOS
-    $input = [1,2,3,4]
-    $output = count($input)
-    notify { $output: }
-    EOS
+  describe 'success' do
+    it 'should count elements in an array' do
+      pp = <<-EOS
+      $input = [1,2,3,4]
+      $output = count($input)
+      notify { $output: }
+      EOS
 
-    apply_manifest(pp, :catch_failures => true) do |r|
-      expect(r.stdout).to match(/Notice: 4/)
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: 4/)
+      end
     end
-  end
 
-  it 'should count elements in an array that match a second argument' do
-    pp = <<-EOS
-    $input = [1,1,1,2]
-    $output = count($input, 1)
-    notify { $output: }
-    EOS
+    it 'should count elements in an array that match a second argument' do
+      pp = <<-EOS
+      $input = [1,1,1,2]
+      $output = count($input, 1)
+      notify { $output: }
+      EOS
 
-    apply_manifest(pp, :catch_failures => true) do |r|
-      expect(r.stdout).to match(/Notice: 3/)
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: 3/)
+      end
     end
   end
 end
index c7f35be5c3e525f698bcdb0f6e83034d42078c2f..676d23d56747962711753beda16c9178c6280fd3 100644 (file)
@@ -1,17 +1,19 @@
 require 'spec_helper_acceptance'
 
 describe 'deep_merge function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
-  it 'should deep merge two hashes' do
-    pp = <<-EOS
-    $hash1 = {'one' => 1, 'two' => 2, 'three' => { 'four' => 4 } }
-    $hash2 = {'two' => 'dos', 'three' => { 'five' => 5 } }
-    $merged_hash = deep_merge($hash1, $hash2)
+  describe 'success' do
+    it 'should deep merge two hashes' do
+      pp = <<-EOS
+      $hash1 = {'one' => 1, 'two' => 2, 'three' => { 'four' => 4 } }
+      $hash2 = {'two' => 'dos', 'three' => { 'five' => 5 } }
+      $merged_hash = deep_merge($hash1, $hash2)
 
-    if $merged_hash != { 'one' => 1, 'two' => 'dos', 'three' => { 'four' => 4, 'five' => 5 } } {
-      fail("Hash was incorrectly merged.")
-    }
-    EOS
+      if $merged_hash != { 'one' => 1, 'two' => 'dos', 'three' => { 'four' => 4, 'five' => 5 } } {
+        fail("Hash was incorrectly merged.")
+      }
+      EOS
 
-    apply_manifest(pp, :catch_failures => true)
+      apply_manifest(pp, :catch_failures => true)
+    end
   end
 end
index eb549e507ca22e57f385d62e8e54a1b063f77df2..747745336ad788dd8982d7969c0b094383a9021a 100644 (file)
@@ -1,19 +1,21 @@
 require 'spec_helper_acceptance'
 
 describe 'defined_with_params function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
-  it 'should successfully notify' do
-    pp = <<-EOS
-    user { 'dan':
-      ensure => present,
-    }
+  describe 'success' do
+    it 'should successfully notify' do
+      pp = <<-EOS
+      user { 'dan':
+        ensure => present,
+      }
 
-    if defined_with_params(User[dan], {'ensure' => 'present' }) {
-      notify { 'User defined with ensure=>present': }
-    }
-    EOS
+      if defined_with_params(User[dan], {'ensure' => 'present' }) {
+        notify { 'User defined with ensure=>present': }
+      }
+      EOS
 
-    apply_manifest(pp, :catch_failures => true) do |r|
-      expect(r.stdout).to match(/Notice: User defined with ensure=>present/)
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: User defined with ensure=>present/)
+      end
     end
   end
 end
index 42d7a77343d64836bb2f87cc4481bf4738b9b3a7..f2c5cfed0b51e808133c03bd68f5ad093502ab97 100644 (file)
@@ -1,16 +1,18 @@
 require 'spec_helper_acceptance'
 
 describe 'delete_at function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
-  it 'should delete elements of the array' do
-    pp = <<-EOS
-    $output = delete_at(['a','b','c','b'], 1)
-    if $output == ['a','c','b'] {
-      notify { 'output correct': }
-    }
-    EOS
+  describe 'success' do
+    it 'should delete elements of the array' do
+      pp = <<-EOS
+      $output = delete_at(['a','b','c','b'], 1)
+      if $output == ['a','c','b'] {
+        notify { 'output correct': }
+      }
+      EOS
 
-    apply_manifest(pp, :catch_failures => true) do |r|
-      expect(r.stdout).to match(/Notice: output correct/)
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
     end
   end
 end
index 63804bc2fd315e49a20a21c238ba37b953efe24b..e54d8164eb1e2b290f561a7d30071990d7b5d616 100644 (file)
@@ -1,16 +1,18 @@
 require 'spec_helper_acceptance'
 
 describe 'delete function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
-  it 'should delete elements of the array' do
-    pp = <<-EOS
-    $output = delete(['a','b','c','b'], 'b')
-    if $output == ['a','c'] {
-      notify { 'output correct': }
-    }
-    EOS
+  describe 'success' do
+    it 'should delete elements of the array' do
+      pp = <<-EOS
+      $output = delete(['a','b','c','b'], 'b')
+      if $output == ['a','c'] {
+        notify { 'output correct': }
+      }
+      EOS
 
-    apply_manifest(pp, :catch_failures => true) do |r|
-      expect(r.stdout).to match(/Notice: output correct/)
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
     end
   end
 end
index 1ecdf4c685d8ff54bfd63d4cb8b490cbe55ed5e5..c2ac93128598089fd9fb5a608c8995d575e0d037 100644 (file)
@@ -1,16 +1,18 @@
 require 'spec_helper_acceptance'
 
 describe 'delete_undef_values function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
-  it 'should delete elements of the array' do
-    pp = <<-EOS
-    $output = delete_undef_values({a=>'A', b=>'', c=>undef, d => false})
-    if $output == { a => 'A', b => '', d => false } {
-      notify { 'output correct': }
-    }
-    EOS
+  describe 'success' do
+    it 'should delete elements of the array' do
+      pp = <<-EOS
+      $output = delete_undef_values({a=>'A', b=>'', c=>undef, d => false})
+      if $output == { a => 'A', b => '', d => false } {
+        notify { 'output correct': }
+      }
+      EOS
 
-    apply_manifest(pp, :catch_failures => true) do |r|
-      expect(r.stdout).to match(/Notice: output correct/)
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/Notice: output correct/)
+      end
     end
   end
 end
diff --git a/spec/acceptance/num2bool_spec.rb b/spec/acceptance/num2bool_spec.rb
new file mode 100644 (file)
index 0000000..cdfbc70
--- /dev/null
@@ -0,0 +1,75 @@
+require 'spec_helper_acceptance'
+
+describe 'num2bool function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
+  describe 'success' do
+    it 'bools positive numbers and numeric strings as true' do
+      pp = <<-EOS
+      $a = 1
+      $b = "1"
+      $c = "50"
+      $ao = num2bool($a)
+      $bo = num2bool($b)
+      $co = num2bool($c)
+      notice(inline_template('a is <%= @ao.inspect %>'))
+      notice(inline_template('b is <%= @bo.inspect %>'))
+      notice(inline_template('c is <%= @co.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/a is true/)
+        expect(r.stdout).to match(/b is true/)
+        expect(r.stdout).to match(/c is true/)
+      end
+    end
+    it 'bools negative numbers as false' do
+      pp = <<-EOS
+      $a = 0
+      $b = -0.1
+      $c = ["-50","1"]
+      $ao = num2bool($a)
+      $bo = num2bool($b)
+      $co = num2bool($c)
+      notice(inline_template('a is <%= @ao.inspect %>'))
+      notice(inline_template('b is <%= @bo.inspect %>'))
+      notice(inline_template('c is <%= @co.inspect %>'))
+      EOS
+
+      apply_manifest(pp, :catch_failures => true) do |r|
+        expect(r.stdout).to match(/a is false/)
+        expect(r.stdout).to match(/b is false/)
+        expect(r.stdout).to match(/c is false/)
+      end
+    end
+  end
+  describe 'failure' do
+    it 'fails on words' do
+      pp = <<-EOS
+      $a = "a"
+      $ao = num2bool($a)
+      notice(inline_template('a is <%= @ao.inspect %>'))
+      EOS
+      expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/not look like a number/)
+    end
+
+    it 'fails on numberwords' do
+      pp = <<-EOS
+      $b = "1b"
+      $bo = num2bool($b)
+      notice(inline_template('b is <%= @bo.inspect %>'))
+      EOS
+      expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/not look like a number/)
+
+    end
+
+    it 'fails on non-numeric/strings' do
+      pending "The function will call .to_s.to_i on anything not a Numeric or
+      String, and results in 0. Is this intended?"
+      pp = <<-EOS
+      $c = {"c" => "-50"}
+      $co = num2bool($c)
+      notice(inline_template('c is <%= @co.inspect %>'))
+      EOS
+      expect(apply_manifest(ppc :expect_failures => true).stderr).to match(/Unable to parse/)
+    end
+  end
+end