]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/stdlib/spec/acceptance/count_spec.rb
upgrade to stdlib 4.6.1
[dsa-puppet.git] / 3rdparty / modules / stdlib / spec / acceptance / count_spec.rb
1 #! /usr/bin/env ruby -S rspec
2 require 'spec_helper_acceptance'
3
4 describe 'count function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
5   describe 'success' do
6     it 'should count elements in an array' do
7       pp = <<-EOS
8       $input = [1,2,3,4]
9       $output = count($input)
10       notify { "$output": }
11       EOS
12
13       apply_manifest(pp, :catch_failures => true) do |r|
14         expect(r.stdout).to match(/Notice: 4/)
15       end
16     end
17
18     it 'should count elements in an array that match a second argument' do
19       pp = <<-EOS
20       $input = [1,1,1,2]
21       $output = count($input, 1)
22       notify { "$output": }
23       EOS
24
25       apply_manifest(pp, :catch_failures => true) do |r|
26         expect(r.stdout).to match(/Notice: 3/)
27       end
28     end
29   end
30 end