mirror of
https://github.com/inspec/inspec
synced 2024-11-10 07:04:15 +00:00
Rough implementation of input() in describe.one, could use dome DRYing
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
This commit is contained in:
parent
c045de4399
commit
b776b84603
1 changed files with 24 additions and 0 deletions
|
@ -17,6 +17,30 @@ module Inspec
|
|||
@action.call("describe.one", @checks, nil)
|
||||
end
|
||||
|
||||
def __profile_id
|
||||
# Excavate the profile ID. The action is a Method calling __add_check on a Rule whose profile ID we want
|
||||
@action.receiver.instance_variable_get(:@__profile_id)
|
||||
end
|
||||
|
||||
def input(input_name, options = {})
|
||||
profile_id = __profile_id
|
||||
|
||||
# TODO: DRY up - remainder of this code is identical to input() in rspec_extensions.rb
|
||||
if options.empty?
|
||||
# Simply an access, no event here
|
||||
Inspec::InputRegistry.find_or_register_input(input_name, profile_id).value
|
||||
else
|
||||
options[:priority] = 20
|
||||
options[:provider] = :inline_control_code
|
||||
evt = Inspec::Input.infer_event(options)
|
||||
Inspec::InputRegistry.find_or_register_input(input_name, profile_id, event: evt).value
|
||||
end
|
||||
end
|
||||
|
||||
def input_object(name)
|
||||
Inspec::InputRegistry.find_or_register_input(name, __profile_id)
|
||||
end
|
||||
|
||||
def method_missing(method_name, *arguments)
|
||||
Inspec::DSL.method_missing_resource(inspec, method_name, *arguments)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue