diff options
author | Josh Cooper <josh@puppet.com> | 2018-06-27 21:40:48 -0700 |
---|---|---|
committer | Josh Cooper <josh@puppet.com> | 2018-06-27 21:40:48 -0700 |
commit | c051e86b350329bc1a7cd1c9c239ec29212b8e56 (patch) | |
tree | 9541699e0d8764e335a25205041d4a7c70495dc3 /spec | |
parent | b9263341547f13a6af09f748d9b9ac483b5d2030 (diff) | |
download | puppet-augeas_core-c051e86b350329bc1a7cd1c9c239ec29212b8e56.tar.gz puppet-augeas_core-c051e86b350329bc1a7cd1c9c239ec29212b8e56.tar.bz2 |
Module creation using pdk 1.5
Diffstat (limited to 'spec')
-rw-r--r-- | spec/default_facts.yml | 8 | ||||
-rw-r--r-- | spec/spec_helper.rb | 36 |
2 files changed, 44 insertions, 0 deletions
diff --git a/spec/default_facts.yml b/spec/default_facts.yml new file mode 100644 index 0000000..3248be5 --- /dev/null +++ b/spec/default_facts.yml @@ -0,0 +1,8 @@ +# Use default_module_facts.yml for module specific facts. +# +# Facts specified here will override the values provided by rspec-puppet-facts. +--- +concat_basedir: "/tmp" +ipaddress: "172.16.254.254" +is_pe: false +macaddress: "AA:AA:AA:AA:AA:AA" diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..e117192 --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,36 @@ + +require 'puppetlabs_spec_helper/module_spec_helper' +require 'rspec-puppet-facts' + +begin + require 'spec_helper_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_local.rb')) +rescue LoadError => loaderror + warn "Could not require spec_helper_local: #{loaderror.message}" +end + +include RspecPuppetFacts + +default_facts = { + puppetversion: Puppet.version, + facterversion: Facter.version, +} + +default_facts_path = File.expand_path(File.join(File.dirname(__FILE__), 'default_facts.yml')) +default_module_facts_path = File.expand_path(File.join(File.dirname(__FILE__), 'default_module_facts.yml')) + +if File.exist?(default_facts_path) && File.readable?(default_facts_path) + default_facts.merge!(YAML.safe_load(File.read(default_facts_path))) +end + +if File.exist?(default_module_facts_path) && File.readable?(default_module_facts_path) + default_facts.merge!(YAML.safe_load(File.read(default_module_facts_path))) +end + +RSpec.configure do |c| + c.default_facts = default_facts + c.before :each do + # set to strictest setting for testing + # by default Puppet runs at warning level + Puppet.settings[:strict] = :warning + end +end |