mirror of
https://github.com/inspec/inspec
synced 2024-11-14 00:47:10 +00:00
Fixed inspec lazy resource loader for rspec test dsl (eg before/after)
This does NOT fix lazy loading of resources at the describe block level. I need to figure out where our backend/inspec/whatever is in that context and it looks like we don't have one available. Signed-off-by: Ryan Davis <zenspider@chef.io>
This commit is contained in:
parent
8fffa5e2cb
commit
9369bad99a
1 changed files with 17 additions and 0 deletions
|
@ -10,6 +10,15 @@ module Inspec
|
|||
module DescribeDslLazyLoader
|
||||
# Support for Describe DSL plugins
|
||||
def method_missing(method_name, *arguments, &block)
|
||||
# TODO: need a backend available at the describe level... class method somewhere?
|
||||
# # see if it is a resource first
|
||||
# begin
|
||||
# resource = Inspec::DSL.method_missing_resource(:where_is_backend?, method_name, *arguments)
|
||||
# return resource if resource
|
||||
# rescue LoadError
|
||||
# # pass through
|
||||
# end
|
||||
|
||||
# Check to see if there is a describe_dsl plugin activator hook with the method name
|
||||
registry = Inspec::Plugin::V2::Registry.instance
|
||||
hook = registry.find_activators(plugin_type: :describe_dsl, activator_name: method_name).first
|
||||
|
@ -39,6 +48,14 @@ module Inspec
|
|||
module TestDslLazyLoader
|
||||
# Support for test DSL plugins
|
||||
def method_missing(method_name, *arguments, &block)
|
||||
# see if it is a resource first
|
||||
begin
|
||||
resource = Inspec::DSL.method_missing_resource(inspec, method_name, *arguments)
|
||||
return resource if resource
|
||||
rescue LoadError
|
||||
# pass through
|
||||
end
|
||||
|
||||
# Check to see if there is a test_dsl plugin activator hook with the method name
|
||||
registry = Inspec::Plugin::V2::Registry.instance
|
||||
hook = registry.find_activators(plugin_type: :test_dsl, activator_name: method_name).first
|
||||
|
|
Loading…
Reference in a new issue