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



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/rspec-puppet/monkey_patches.rb', line 119

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



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

alias :old_find_manifests_in_modules :find_manifests_in_modules