From 44596e73da1b157ea931d5111f842e108ca203bb Mon Sep 17 00:00:00 2001 From: Alex Tomlins Date: Thu, 7 Apr 2016 22:22:17 +0100 Subject: (MODULES-3246) Fix concat with Hash arguments. 85d5ead Updated the concat function so that it wouldn't modify the original array. A side-effect of this change is that it now always calls `Array()` on the second argument. If thit is a Hash, this results in `to_a` being called on the hash, which converts it to an array or tuples. This is undesired. Update the behaviour so that it doesn't (indirectly) call `to_a` on anything, instead test for the type of the argument, wrapping it in an array if it's not already an array. --- spec/functions/concat_spec.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'spec/functions') diff --git a/spec/functions/concat_spec.rb b/spec/functions/concat_spec.rb index 1694d5e..eb76233 100755 --- a/spec/functions/concat_spec.rb +++ b/spec/functions/concat_spec.rb @@ -11,6 +11,7 @@ describe 'concat' do it { is_expected.to run.with_params(['1','2','3'],[['4','5'],'6']).and_return(['1','2','3',['4','5'],'6']) } it { is_expected.to run.with_params(['1','2'],['3','4'],['5','6']).and_return(['1','2','3','4','5','6']) } it { is_expected.to run.with_params(['1','2'],'3','4',['5','6']).and_return(['1','2','3','4','5','6']) } + it { is_expected.to run.with_params([{"a" => "b"}], {"c" => "d", "e" => "f"}).and_return([{"a" => "b"}, {"c" => "d", "e" => "f"}]) } it "should leave the original array intact" do argument1 = ['1','2','3'] -- cgit v1.2.3