mirror of
https://github.com/inspec/inspec
synced 2024-11-23 05:03:07 +00:00
Improvements in various descriptions and a better way to check for hash type
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
This commit is contained in:
parent
c0b213c46a
commit
a55b083b0a
4 changed files with 4 additions and 8 deletions
|
@ -256,7 +256,7 @@ module Inspec
|
|||
|
||||
data.inputs.each do |input_name, input_value|
|
||||
evt = Inspec::Input::Event.new(
|
||||
value: input_value&.class.eql?(Hash) ? Thor::CoreExt::HashWithIndifferentAccess.new(input_value) : input_value,
|
||||
value: input_value.is_a?(Hash) ? Thor::CoreExt::HashWithIndifferentAccess.new(input_value) : input_value,
|
||||
provider: :cli_files,
|
||||
priority: 40,
|
||||
file: path
|
||||
|
@ -307,7 +307,7 @@ module Inspec
|
|||
def handle_raw_input_from_metadata(input_orig, profile_name)
|
||||
input_options = input_orig.dup
|
||||
input_name = input_options.delete(:name)
|
||||
input_options[:value] = Thor::CoreExt::HashWithIndifferentAccess.new(input_options[:value]) if input_options[:value]&.class.eql?(Hash)
|
||||
input_options[:value] = Thor::CoreExt::HashWithIndifferentAccess.new(input_options[:value]) if input_options[:value].is_a?(Hash)
|
||||
input_options[:provider] = :profile_metadata
|
||||
input_options[:file] = File.join(profile_name, "inspec.yml")
|
||||
input_options[:priority] ||= 30
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
# copyright: 218, The Authors
|
||||
title "Verifying loading of hashmap inputs using metadata and external file"
|
||||
|
||||
# controls to test metadata file hash traversing
|
||||
|
||||
control "hashmap-metadata" do
|
||||
title "Verifying loading of hashmap inputs using metadata file"
|
||||
|
||||
|
@ -16,8 +14,6 @@ control "hashmap-metadata" do
|
|||
end
|
||||
end
|
||||
|
||||
# controls to test external attribute file hash traversing
|
||||
|
||||
control "hashmap-external-file" do
|
||||
title "Verifying loading of hashmap inputs using external file"
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ maintainer: The Authors
|
|||
copyright: The Authors
|
||||
copyright_email: you@example.com
|
||||
license: Apache-2.0
|
||||
summary: A profile that checks the hash inputs using metadata file and external file.
|
||||
summary: A profile that checks loading of hashmap inputs using metadata file and external file.
|
||||
version: 0.1.0
|
||||
supports:
|
||||
platform: os
|
||||
|
|
|
@ -445,7 +445,7 @@ describe "inputs" do
|
|||
end
|
||||
|
||||
describe "when a profile is executed with external inputs and inputs defined in metadata file" do
|
||||
it "should access the values successfully from in both input ways" do
|
||||
it "should access the values successfully from both input ways" do
|
||||
result = run_inspec_process("exec #{inputs_profiles_path}/hashmap --input-file #{external_attributes_file_path}", json: true)
|
||||
_(result.stderr).must_be_empty
|
||||
assert_json_controls_passing(result)
|
||||
|
|
Loading…
Reference in a new issue