From afb78e2b253dfe43816e20afa2f4732eb9dc17eb Mon Sep 17 00:00:00 2001 From: Ashley Penney Date: Thu, 13 Mar 2014 18:21:38 +0000 Subject: Add some acceptance tests for functions. --- spec/acceptance/bool2num_spec.rb | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 spec/acceptance/bool2num_spec.rb (limited to 'spec/acceptance/bool2num_spec.rb') diff --git a/spec/acceptance/bool2num_spec.rb b/spec/acceptance/bool2num_spec.rb new file mode 100644 index 0000000..5bdb452 --- /dev/null +++ b/spec/acceptance/bool2num_spec.rb @@ -0,0 +1,31 @@ +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 + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: 0/) + 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 + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: 1/) + end + end + end +end -- cgit v1.2.3 From f8f147e794ad305bb8f2dbf5e3a612f0659834ba Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Tue, 8 Apr 2014 15:04:55 -0700 Subject: Add success/fail groups --- spec/acceptance/bool2num_spec.rb | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) (limited to 'spec/acceptance/bool2num_spec.rb') diff --git a/spec/acceptance/bool2num_spec.rb b/spec/acceptance/bool2num_spec.rb index 5bdb452..1cbd88d 100644 --- a/spec/acceptance/bool2num_spec.rb +++ b/spec/acceptance/bool2num_spec.rb @@ -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 -- cgit v1.2.3