From f9bd8755ed4bf88af62360f37061d838f1818cfd Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Mon, 27 Dec 2021 11:58:53 +0900 Subject: [PATCH] Load libraries in a single place This change refactors how the dependent libraries are loaded during unit tests, and load the libraries in the base spec_helper to avoid duplicate and redundant implementations. Change-Id: I440118c0a63a19cde453c2ba5b73b23604d868cd --- spec/spec_helper.rb | 3 +++ .../ceilometer_config/openstackconfig_spec.rb | 23 ------------------- 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 4a5c46c3..33f27e2d 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,6 @@ +# Load libraries here to simulate how they live together in a real puppet run (for provider unit tests) +$LOAD_PATH.push(File.join(File.dirname(__FILE__), 'fixtures', 'modules', 'inifile', 'lib')) +$LOAD_PATH.push(File.join(File.dirname(__FILE__), 'fixtures', 'modules', 'openstacklib', 'lib')) require 'puppetlabs_spec_helper/module_spec_helper' require 'shared_examples' require 'puppet-openstack_spec_helper/facts' diff --git a/spec/unit/provider/ceilometer_config/openstackconfig_spec.rb b/spec/unit/provider/ceilometer_config/openstackconfig_spec.rb index dd5e5d49..b275b7a1 100644 --- a/spec/unit/provider/ceilometer_config/openstackconfig_spec.rb +++ b/spec/unit/provider/ceilometer_config/openstackconfig_spec.rb @@ -1,26 +1,3 @@ -$LOAD_PATH.push( - File.join( - File.dirname(__FILE__), - '..', - '..', - '..', - 'fixtures', - 'modules', - 'inifile', - 'lib') -) -$LOAD_PATH.push( - File.join( - File.dirname(__FILE__), - '..', - '..', - '..', - 'fixtures', - 'modules', - 'openstacklib', - 'lib') -) - require 'spec_helper' provider_class = Puppet::Type.type(:ceilometer_config).provider(:openstackconfig)