Deep freeze only strings, arrays and hashes #447
Freezing a class prevents it from being modified at all, which can
Calling a function with
This whitelists strings, arrays and hashes as safe classes to freeze
Alternative to #446 with a whitelisted set of classes instead of blacklisting Class specifically. This is closer to Puppet's implementation at https://github.com/puppetlabs/puppet/blob/master/lib/puppet/parser/scope.rb#L775, per the discussion on #442.
Freezing a class prevents it from being modified at all, which can happen in unit tests with mocha or rspec-expections. Calling a function with `String` as an argument will freeze the entire class and prevent `allow_any_instance_of(String)...` type expectations from adding their hooks to the class. e.g. stdlib: https://github.com/puppetlabs/puppetlabs-stdlib/blob/00c881d/spec/functions/is_a_spec.rb#L18 https://github.com/puppetlabs/puppetlabs-stdlib/blob/00c881d/spec/functions/pw_hash_spec.rb#L57 This whitelists strings, arrays and hashes as safe classes to freeze when testing functions, others are left thawed to prevent side effects. Deep freezing is used on arrays/hashes to match Puppet's behaviour of freezing facts.