Skip to content

Commit

Permalink
Fix Puppet::Util::Autoload.load_file to ignore stubbing
Browse files Browse the repository at this point in the history
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 5778fd7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rspec-puppet/monkey_patches.rb
Expand Up @@ -213,7 +213,7 @@ def pretending?
end end


class Autoload class Autoload
if singleton_class.respond_to?(:load_file) if respond_to?(:load_file)
singleton_class.send(:alias_method, :old_load_file, :load_file) singleton_class.send(:alias_method, :old_load_file, :load_file)


def self.load_file(*args) def self.load_file(*args)
Expand Down

0 comments on commit 5778fd7

Please sign in to comment.