Merge pull request #4549 from inspec/zenspider/describe.one

Added method_missing to Inspec::DescribeBase (used by describe.one) to fix resource loading
This commit is contained in:
Clinton Wolfe 2019-10-02 00:06:56 -04:00 committed by GitHub
commit a4090f9c1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 8 deletions

View file

@ -17,6 +17,10 @@ module Inspec
@action.call("describe.one", @checks, nil) @action.call("describe.one", @checks, nil)
end end
def method_missing(method_name, *arguments)
Inspec::DSL.method_missing_resource(inspec, method_name, *arguments)
end
def describe(*args, &block) def describe(*args, &block)
@checks.push(["describe", args, block]) @checks.push(["describe", args, block])
end end

View file

@ -344,15 +344,14 @@ module Inspec
def with_dsl(block) def with_dsl(block)
return nil if block.nil? return nil if block.nil?
if self.class.resource_dsl
dsl = self.class.resource_dsl dsl = self.class.resource_dsl
return block unless dsl
proc do |*args| proc do |*args|
include dsl include dsl
instance_exec(*args, &block) instance_exec(*args, &block)
end end
else
block
end
end end
# Idio(ma)tic unindent, behaves similar to Ruby2.3 curly heredocs. # Idio(ma)tic unindent, behaves similar to Ruby2.3 curly heredocs.