1 require 'spec_helper_acceptance'
3 describe 'any2array function' do
7 $output = any2array($input)
8 validate_array($output)
9 notify { "Output: ${output}": }
11 it 'creates an empty array' do
12 apply_manifest(pp1, :catch_failures => true) do |r|
13 expect(r.stdout).to match(%r{Notice: Output: })
18 $input = ['array', 'test']
19 $output = any2array($input)
20 validate_array($output)
21 notify { "Output: ${output}": }
23 it 'leaves arrays modified' do
24 apply_manifest(pp2, :catch_failures => true) do |r|
25 expect(r.stdout).to match(%r{Notice: Output: (\[|)array(,\s|)test(\]|)})
30 $input = {'test' => 'array'}
31 $output = any2array($input)
33 validate_array($output)
34 # Check each element of the array is a plain string.
35 validate_string($output[0])
36 validate_string($output[1])
37 notify { "Output: ${output}": }
39 it 'turns a hash into an array' do
40 apply_manifest(pp3, :catch_failures => true) do |r|
41 expect(r.stdout).to match(%r{Notice: Output: (\[|)test(,\s|)array(\]|)})