Module: Parser::Files

Defined in:
lib/rspec-puppet/monkey_patches.rb

Class Method Summary collapse

Class Method Details

.find_manifests_in_modules(pattern, environment) ⇒ Object



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/rspec-puppet/monkey_patches.rb', line 107

def find_manifests_in_modules(pattern, environment)
  if RSpec::Puppet.rspec_puppet_example?
    pretending = Puppet::Util::Platform.pretend_platform

    unless pretending.nil?
      Puppet::Util::Platform.pretend_to_be nil
      RSpec::Puppet::Consts.stub_consts_for(RSpec.configuration.platform)
    end

    if pretending && pretending != Puppet::Util::Platform.actual_platform
      environment.send(:value_cache).clear if environment.respond_to?(:value_cache, true)
    end
    output = old_find_manifests_in_modules(pattern, environment)

    unless pretending.nil?
      Puppet::Util::Platform.pretend_to_be pretending
      RSpec::Puppet::Consts.stub_consts_for pretending
    end

    output
  else
    old_find_manifests_in_modules(pattern, environment)
  end
end

.old_find_manifests_in_modulesObject



104
# File 'lib/rspec-puppet/monkey_patches.rb', line 104

alias :old_find_manifests_in_modules :find_manifests_in_modules