Permalink
Browse files

Fix Puppet::Util::Autoload.load_file to ignore stubbing

I mistakenly added `singleton_class` when checking if the class responds to
`load_file` (to support older versions of Puppet). This is obviously not
the correct method of determining if a class method has been defined and
as such did not work as intended.

This lead to the platform stubbing still being in place when `Kernel.load`
was being called, causing the problems reported by @cdenneen (where
a provider was evaluating `Puppet.features.microsoft_windows?` at load
time).
  • Loading branch information...
rodjek committed Oct 4, 2018
1 parent 62beeb7 commit 5778fd7381123f0170a0887b97b4bc38c9bfb331
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/rspec-puppet/monkey_patches.rb
@@ -213,7 +213,7 @@ def pretending?
end
class Autoload
if singleton_class.respond_to?(:load_file)
if respond_to?(:load_file)
singleton_class.send(:alias_method, :old_load_file, :load_file)
def self.load_file(*args)

0 comments on commit 5778fd7

Please sign in to comment.