Skip to content

Commit

Permalink
Accessing nested mappings in a yam file (#1242)
Browse files Browse the repository at this point in the history
* While working with mongod.conf file I spent hours trying to figure out how to access nested mappings.  When I read the code it used keys.shift to traverse the yaml object.  I tried changing to an array and voila I was able to access nested mappings.  I wanted to document my findngs and suggest an update to inspec.io but couldn't find a place to contact someone for the suggestion.

* Added additional details regarding the formatting of the example.

Signed-off-by: Chris Wessells <cwessells@silvervue.com>
  • Loading branch information
chriswessells authored and chris-rock committed Oct 25, 2016
1 parent b4c6534 commit 64b3461
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,12 @@ describe sshd_config do
end
```

* Test your `kitchen.yml` file to verify that only Vagrant is configured as the driver.
* Test your `kitchen.yml` file to verify that only Vagrant is configured as the driver. The %w() formatting will
pass rubocop lintng and allow you to access nested mappings.

```ruby
describe yaml('.kitchen.yml') do
its('driver.name') { should eq('vagrant') }
its(%w(driver name)) { should eq('vagrant') }
end
```

Expand Down

0 comments on commit 64b3461

Please sign in to comment.