summaryrefslogtreecommitdiff
path: root/spec/unit/puppet/parser
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/puppet/parser')
-rwxr-xr-xspec/unit/puppet/parser/functions/delete_spec.rb18
-rw-r--r--spec/unit/puppet/parser/functions/pick_spec.rb2
2 files changed, 19 insertions, 1 deletions
diff --git a/spec/unit/puppet/parser/functions/delete_spec.rb b/spec/unit/puppet/parser/functions/delete_spec.rb
index 2f29c93..06238f1 100755
--- a/spec/unit/puppet/parser/functions/delete_spec.rb
+++ b/spec/unit/puppet/parser/functions/delete_spec.rb
@@ -35,4 +35,22 @@ describe "the delete function" do
result.should(eq({ 'a' => 1, 'c' => 3 }))
end
+ it "should not change origin array passed as argument" do
+ origin_array = ['a','b','c','d']
+ result = scope.function_delete([origin_array, 'b'])
+ origin_array.should(eq(['a','b','c','d']))
+ end
+
+ it "should not change the origin string passed as argument" do
+ origin_string = 'foobarbabarz'
+ result = scope.function_delete([origin_string,'bar'])
+ origin_string.should(eq('foobarbabarz'))
+ end
+
+ it "should not change origin hash passed as argument" do
+ origin_hash = { 'a' => 1, 'b' => 2, 'c' => 3 }
+ result = scope.function_delete([origin_hash, 'b'])
+ origin_hash.should(eq({ 'a' => 1, 'b' => 2, 'c' => 3 }))
+ end
+
end
diff --git a/spec/unit/puppet/parser/functions/pick_spec.rb b/spec/unit/puppet/parser/functions/pick_spec.rb
index 761db6b..d2b275f 100644
--- a/spec/unit/puppet/parser/functions/pick_spec.rb
+++ b/spec/unit/puppet/parser/functions/pick_spec.rb
@@ -29,6 +29,6 @@ describe "the pick function" do
end
it 'should error if no values are passed' do
- expect { scope.function_pick([]) }.to raise_error(Puppet::Error, /Must provide non empty value./)
+ expect { scope.function_pick([]) }.to( raise_error(Puppet::ParseError, "pick(): must receive at last one non empty value"))
end
end