1 #! /usr/bin/env ruby -S rspec
2 require 'spec_helper_acceptance'
4 describe 'concat function' do
6 it 'should concat one array to another' do
8 $output = concat(['1','2','3'],['4','5','6'])
9 validate_array($output)
10 if size($output) != 6 {
11 fail("${output} should have 6 elements.")
15 apply_manifest(pp, :catch_failures => true)
17 it 'should concat arrays and primitives to array' do
19 $output = concat(['1','2','3'],'4','5','6',['7','8','9'])
20 validate_array($output)
21 if size($output) != 9 {
22 fail("${output} should have 9 elements.")
26 apply_manifest(pp, :catch_failures => true)
28 it 'should concat multiple arrays to one' do
30 $output = concat(['1','2','3'],['4','5','6'],['7','8','9'])
31 validate_array($output)
32 if size($output) != 9 {
33 fail("${output} should have 9 elements.")
37 apply_manifest(pp, :catch_failures => true)
39 it 'should concat hash arguments' do
41 $output = concat([{"a" => "b"}], {"c" => "d", "e" => "f"})
42 validate_array($output)
43 if size($output) != 2 {
44 fail("${output} should have 2 elements.")
46 if $output[1] != {"c" => "d", "e" => "f"} {
47 fail("${output} does not have the expected hash for the second element.")
51 apply_manifest(pp, :catch_failures => true)