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/count_spec.rb | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 spec/acceptance/count_spec.rb (limited to 'spec/acceptance/count_spec.rb') diff --git a/spec/acceptance/count_spec.rb b/spec/acceptance/count_spec.rb new file mode 100644 index 0000000..cc46be0 --- /dev/null +++ b/spec/acceptance/count_spec.rb @@ -0,0 +1,27 @@ +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 + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: 4/) + 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 + + apply_manifest(pp, :catch_failures => true) do |r| + expect(r.stdout).to match(/Notice: 3/) + end + end +end -- cgit v1.2.3