summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSpencer Krum <nibz@cat.pdx.edu>2013-11-19 20:11:08 -0800
committerHunter Haugen <hunter@puppetlabs.com>2014-07-31 11:23:34 -0700
commita6ad0af08e408adbb4b25684b18feb8aee12cf3e (patch)
tree54a0ec7647debbf3176e5e71d66257f223a47330
parent85d5eadbab273e838eb2de33e78054b8d3867f41 (diff)
Introduce test for array destruction
It was discovered that the concat array modifies the arrays passed to it as an argument as a side effect. This test will ensure that doesn't happen again.
-rwxr-xr-xspec/functions/concat_spec.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/spec/functions/concat_spec.rb b/spec/functions/concat_spec.rb
index b853b4c..49cb2ad 100755
--- a/spec/functions/concat_spec.rb
+++ b/spec/functions/concat_spec.rb
@@ -27,4 +27,9 @@ describe "the concat function" do
expect(result).to(eq(['1','2','3',['4','5'],'6']))
end
+ it "should leave the original array intact" do
+ array_original = ['1','2','3']
+ result = scope.function_concat([array_original,['4','5','6']])
+ array_original.should(eq(['1','2','3']))
+ end
end