module Puppet::Parser::Files

Public Class Methods

find_manifests_in_modules(pattern, environment) click to toggle source
# 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

Public Instance Methods

old_find_manifests_in_modules(pattern, environment)

Private Instance Methods

find_manifests_in_modules(pattern, environment) click to toggle source
# 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