]> review.fuel-infra Code Review - puppet-modules/puppet-ceilometer.git/commitdiff
Load libraries in a single place
authorTakashi Kajinami <tkajinam@redhat.com>
Mon, 27 Dec 2021 02:58:53 +0000 (11:58 +0900)
committerTakashi Kajinami <tkajinam@redhat.com>
Mon, 27 Dec 2021 02:58:53 +0000 (11:58 +0900)
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
spec/unit/provider/ceilometer_config/openstackconfig_spec.rb

index 4a5c46c36ccf0fb05667a885ab0f0d20948330a3..33f27e2d53281060d4fc03f7e4c555499c29aa48 100644 (file)
@@ -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'
index dd5e5d49883221ae356158f8de55869711dd6f29..b275b7a171acb3d79161365451c0f2e0ef5ee509 100644 (file)
@@ -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)