summaryrefslogtreecommitdiff
path: root/chef-config
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-09-20 23:57:26 -0700
committerTim Smith <tsmith84@gmail.com>2020-09-20 23:57:26 -0700
commiteb49e6b6b8c160da0cf53f05fefa1c90d7a3a993 (patch)
treeec146beb48dda66abdefe0d0330c71c053498b18 /chef-config
parentcb6ee920847d91b8c6cd8e7cb210b8a4fc730e69 (diff)
downloadchef-eb49e6b6b8c160da0cf53f05fefa1c90d7a3a993.tar.gz
Gate requires in chef-utils and chef-config as wellrequires
Update the cop config to handle those as well Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'chef-config')
-rw-r--r--chef-config/lib/chef-config/config.rb6
-rw-r--r--chef-config/spec/spec_helper.rb2
-rw-r--r--chef-config/spec/unit/fips_spec.rb2
-rw-r--r--chef-config/spec/unit/workstation_config_loader_spec.rb4
4 files changed, 7 insertions, 7 deletions
diff --git a/chef-config/lib/chef-config/config.rb b/chef-config/lib/chef-config/config.rb
index 58b60e5295..7451f744a7 100644
--- a/chef-config/lib/chef-config/config.rb
+++ b/chef-config/lib/chef-config/config.rb
@@ -1258,9 +1258,9 @@ module ChefConfig
# @api private
def self.enable_fips_mode
OpenSSL.fips_mode = true
- require "digest"
- require "digest/sha1"
- require "digest/md5"
+ require "digest" unless defined?(Digest)
+ require "digest/sha1" unless defined?(Digest::SHA1)
+ require "digest/md5" unless defined?(Digest::MD5)
# Remove pre-existing constants if they do exist to reduce the
# amount of log spam and warnings.
Digest.send(:remove_const, "SHA1") if Digest.const_defined?("SHA1")
diff --git a/chef-config/spec/spec_helper.rb b/chef-config/spec/spec_helper.rb
index 557f1f6432..fb6e78a6b1 100644
--- a/chef-config/spec/spec_helper.rb
+++ b/chef-config/spec/spec_helper.rb
@@ -1,4 +1,4 @@
-require "chef-utils"
+require "chef-utils" unless defined?(ChefUtils)
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
diff --git a/chef-config/spec/unit/fips_spec.rb b/chef-config/spec/unit/fips_spec.rb
index 5ee62b6c79..4be6f64a2d 100644
--- a/chef-config/spec/unit/fips_spec.rb
+++ b/chef-config/spec/unit/fips_spec.rb
@@ -20,7 +20,7 @@ require "chef-config/fips"
require "spec_helper"
begin
- require "win32/registry"
+ require "win32/registry" unless defined?(Win32::Registry)
rescue LoadError
# not on unix
end
diff --git a/chef-config/spec/unit/workstation_config_loader_spec.rb b/chef-config/spec/unit/workstation_config_loader_spec.rb
index c589b298ae..cffc316240 100644
--- a/chef-config/spec/unit/workstation_config_loader_spec.rb
+++ b/chef-config/spec/unit/workstation_config_loader_spec.rb
@@ -17,10 +17,10 @@
#
require "spec_helper"
-require "tempfile"
+require "tempfile" unless defined?(Tempfile)
require "chef-config/exceptions"
-require "chef-utils"
+require "chef-utils" unless defined?(ChefUtils)
require "chef-config/workstation_config_loader"
RSpec.describe ChefConfig::WorkstationConfigLoader do