]> gitweb.fluxo.info Git - puppet-stdlib.git/commitdiff
Added rspec tests for the new behaviour of merge accepting empty strings
authorMartin Hellmich <mhellmic@gmail.com>
Wed, 8 May 2013 16:20:56 +0000 (18:20 +0200)
committerMartin Hellmich <mhellmic@gmail.com>
Wed, 8 May 2013 16:24:46 +0000 (18:24 +0200)
added test that '' is accepted
changed a test that a number is correctly rejected with a type error

spec/unit/puppet/parser/functions/merge_spec.rb

index 04169e7e755de294d81725ef356ea1c7ee1daef7..8a170bb1c505140fec5c93f68a6dc12de9a42863 100644 (file)
@@ -26,6 +26,11 @@ describe Puppet::Parser::Functions.function(:merge) do
   describe 'when calling merge on the scope instance' do
     it 'should require all parameters are hashes' do
       expect { new_hash = scope.function_merge([{}, '2'])}.to raise_error(Puppet::ParseError, /unexpected argument type String/)
+      expect { new_hash = scope.function_merge([{}, 2])}.to raise_error(Puppet::ParseError, /unexpected argument type Fixnum/)
+    end
+
+    it 'should accept empty strings as puppet undef' do
+      expect { new_hash = scope.function_merge([{}, ''])}.not_to raise_error(Puppet::ParseError, /unexpected argument type String/)
     end
 
     it 'should be able to merge two hashes' do