| 1 | require 'spec_helper'
|
|---|
| 2 |
|
|---|
| 3 | describe 'concat' do
|
|---|
| 4 | it { is_expected.not_to eq(nil) }
|
|---|
| 5 | it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError) }
|
|---|
| 6 | it { is_expected.to run.with_params([1]).and_raise_error(Puppet::ParseError) }
|
|---|
| 7 | it { is_expected.to run.with_params(1, [2]).and_raise_error(Puppet::ParseError) }
|
|---|
| 8 | it { is_expected.to run.with_params([1], [2], [3]).and_return([1, 2, 3]) }
|
|---|
| 9 | it { is_expected.to run.with_params(['1','2','3'],['4','5','6']).and_return(['1','2','3','4','5','6']) }
|
|---|
| 10 | it { is_expected.to run.with_params(['1','2','3'],'4').and_return(['1','2','3','4']) }
|
|---|
| 11 | it { is_expected.to run.with_params(['1','2','3'],[['4','5'],'6']).and_return(['1','2','3',['4','5'],'6']) }
|
|---|
| 12 | it { is_expected.to run.with_params(['1','2'],['3','4'],['5','6']).and_return(['1','2','3','4','5','6']) }
|
|---|
| 13 | it { is_expected.to run.with_params(['1','2'],'3','4',['5','6']).and_return(['1','2','3','4','5','6']) }
|
|---|
| 14 | it { is_expected.to run.with_params([{"a" => "b"}], {"c" => "d", "e" => "f"}).and_return([{"a" => "b"}, {"c" => "d", "e" => "f"}]) }
|
|---|
| 15 |
|
|---|
| 16 | it "should leave the original array intact" do
|
|---|
| 17 | argument1 = ['1','2','3']
|
|---|
| 18 | original1 = argument1.dup
|
|---|
| 19 | argument2 = ['4','5','6']
|
|---|
| 20 | original2 = argument2.dup
|
|---|
| 21 | result = subject.call([argument1,argument2])
|
|---|
| 22 | expect(argument1).to eq(original1)
|
|---|
| 23 | expect(argument2).to eq(original2)
|
|---|
| 24 | end
|
|---|
| 25 | end
|
|---|