1 require 'puppetlabs_spec_helper/module_spec_helper'
2 require 'rspec-puppet-facts'
4 require 'spec_helper_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_local.rb'))
6 include RspecPuppetFacts
9 puppetversion: Puppet.version,
10 facterversion: Facter.version,
13 default_fact_files = [
14 File.expand_path(File.join(File.dirname(__FILE__), 'default_facts.yml')),
15 File.expand_path(File.join(File.dirname(__FILE__), 'default_module_facts.yml')),
18 default_fact_files.each do |f|
19 next unless File.exist?(f) && File.readable?(f) && File.size?(f)
22 default_facts.merge!(YAML.safe_load(File.read(f)))
24 RSpec.configuration.reporter.message "WARNING: Unable to load #{f}: #{e}"
28 RSpec.configure do |c|
29 c.default_facts = default_facts
31 # set to strictest setting for testing
32 # by default Puppet runs at warning level
33 Puppet.settings[:strict] = :warning
37 def ensure_module_defined(module_name)
38 module_name.split('::').reduce(Object) do |last_module, next_module|
39 last_module.const_set(next_module, Module.new) unless last_module.const_defined?(next_module, false)
40 last_module.const_get(next_module, false)
44 # 'spec_overrides' from sync.yml will appear below this line