lib/inspec/backend.rb in inspec-1.46.2 vs lib/inspec/backend.rb in inspec-1.47.0

- old
+ new

@@ -51,9 +51,21 @@ connection = transport.connection if connection.nil? raise "Can't connect to transport backend '#{name}'." end + # Set caching settings. We always want to enable caching for + # the Mock transport for testing. + if config[:backend_cache] || config[:backend] == :mock + connection.enable_cache(:file) + connection.enable_cache(:command) + elsif config[:debug_shell] + connection.disable_cache(:file) + connection.disable_cache(:command) + else + connection.disable_cache(:command) + end + cls = Class.new do include Base define_method :backend do connection