Merge pull request #4565 from inspec/zenspider/rspec_method_missing

Fix problem in method_missing in rspec extensions when backend unavailable.
This commit is contained in:
Ryan Davis 2019-10-04 13:02:21 -07:00 committed by GitHub
commit 471524711a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

View file

@ -34,6 +34,8 @@ module Inspec::DSL
# resource.
def self.method_missing_resource(backend, id, *arguments)
return unless backend
begin
require "inspec/resources/#{id}"
rescue LoadError

View file

@ -50,6 +50,7 @@ module Inspec
def method_missing(method_name, *arguments, &block)
# see if it is a resource first
begin
inspec = inspec if respond_to?(:inspec) # backend not available??
resource = Inspec::DSL.method_missing_resource(inspec, method_name, *arguments)
return resource if resource
rescue LoadError