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



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/rspec-puppet/monkey_patches.rb', line 93

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.respond_to?(:value_cache,
                                                                                                     true)
      environment.send(:value_cache).clear
    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



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

alias old_find_manifests_in_modules find_manifests_in_modules