From 3d586889542d4a9ffc16f5af64dcfa00587b554f Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Mon, 27 Dec 2021 11:04:33 +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: If62b2bdffbf663ee1a41a8da381eb66c223caee0 --- spec/spec_helper.rb | 3 +++ .../tempest_config/ini_setting_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/tempest_config/ini_setting_spec.rb b/spec/unit/provider/tempest_config/ini_setting_spec.rb index 1bb15548..427cbff6 100644 --- a/spec/unit/provider/tempest_config/ini_setting_spec.rb +++ b/spec/unit/provider/tempest_config/ini_setting_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(:tempest_config).provider(:ini_setting)