mirror of
https://github.com/inspec/inspec
synced 2024-11-23 21:23:29 +00:00
Merge pull request #4534 from inspec/zenspider/rspec/resources
Fixed inspec lazy resource loader for rspec test dsl (eg before/after)
This commit is contained in:
commit
737badc619
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