From ae038d99087c80d6ab239f1f9cb98dc63f649094 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Wed, 2 Jun 2021 14:03:42 +0900 Subject: [PATCH] Set fixture paths for unit tests This change defines manifest_dir and module_path expicitly in unit tests so that modules installed under fixtures directory is properly loaded. Closes-Bug: #1930403 Change-Id: I8c0589bccbac4776720badfdb009b966ac2f7087 (cherry picked from commit c0f33c2806eefc79fdc82a1eccb67a4c3b9ad68c) --- spec/spec_helper.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index e8ae4c00f..2f1593ee9 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -5,12 +5,17 @@ require 'shared_examples' require 'webmock/rspec' require 'puppet-openstack_spec_helper/facts' +fixture_path = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures')) + # LP1492636 - Cohabitation of compile matcher and webmock WebMock.disable_net_connect!(:allow => "169.254.169.254") RSpec.configure do |c| c.alias_it_should_behave_like_to :it_configures, 'configures' c.alias_it_should_behave_like_to :it_raises, 'raises' + + c.module_path = File.join(fixture_path, 'modules') + c.manifest_dir = File.join(fixture_path, 'manifests') end RSpec::Matchers.define :be_absent do @@ -34,5 +39,3 @@ def setup_provider_tests end end end - -Dir[File.dirname(__FILE__) + '/support/**/*.rb'].each { |f| require f }