X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=spec%2Fspec_helper.rb;h=15266c201ac0f21c7918ba53178ff9f423e36d59;hb=4d21aebedd1160fbfbdce2b33f62109d87dd2aea;hp=660e21823c075e580de649459aba06d32cc0c998;hpb=64e1bf9a2f90e3546de11bf2a3375bb530e561ea;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 660e218..15266c2 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,18 +1,23 @@ -require 'rubygems' -require 'puppet' -require 'rspec-puppet' +require 'puppetlabs_spec_helper/module_spec_helper' +require 'rspec-puppet-facts' +include RspecPuppetFacts -def param_value(subject, type, title, param) - subject.resource(type, title).send(:parameters)[param.to_sym] -end +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')) -Puppet.parse_config -puppet_module_path = Puppet[:modulepath] +if File.exist?(default_facts_path) && File.readable?(default_facts_path) + default_facts.merge!(YAML.safe_load(File.read(default_facts_path))) +end -fixture_path = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures')) +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| - fixture_module_path = File.join(fixture_path, 'modules') - c.module_path = [fixture_module_path, puppet_module_path].join(":") - c.manifest_dir = File.join(fixture_path, 'manifests') + c.default_facts = default_facts end