Skip to content

Add object traversal #14

Open
Open
@gsreynolds

Description

@gsreynolds

https://github.com/chef-customers/inspec-alicloud/blob/a489f34eb6202f0bfe542019e85082786fa435e5/libraries/alicloud_slb_https_listener.rb#L46-L49

inspec/utils/object_traversal is useful for multi level traversal of an object using method_missing, if there are many possible things you might need to check. The core InSpec JSON resource is a good example of this since there's no way of knowing when you write the resource the things that users will need to check. The same magic can be implemented in custom resources using object traversal e.g.

its(%w(SomePolicy OptionA)) { should cmp false }
its(%w(SomePolicy OptionB)) { should cmp false }
its(%w(SomePolicy HashOfOptions OptionZ)) { should cmp false }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions