Method: RSpec::Core::ExampleGroup#input

Defined in:
lib/inspec/rspec_extensions.rb

#input(input_name, options = {}) ⇒ Object

This DSL method allows us to access the values of inputs within InSpec tests



85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/inspec/rspec_extensions.rb', line 85

def input(input_name, options = {})
  profile_id = self.class.[:profile_id]
  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