inspec/test/unit/utils
Adam Leff 4f2b66302d Fix ObjectTraverser when accessing array values
When attempting to access array values via the `json` resource:

```
describe json('/tmp/test.json') do
      its(['array',0]) { should eq "zero" }
end
```

... the resulting data would be an array of the size of the original array
with all the values replaced with nils:

```
     expected: "zero"
          got: [nil, nil, nil]
```

This was due to a bug in the ObjectTraverser mixin that mapped array values
back through `extract_value` rather than properly handling the passed-in
key(s). This worked fine for the specific data format created by the `csv`
resource but did not work `json` or any other resource that subclassed the
`JsonConfig` resource.

This change fixes the logic when dealing with an array when it's encountered,
and fixes up the `csv` resource with its own `value` method.

This change also adds tests for ObjectTraverser.

Signed-off-by: Adam Leff <adam@leff.co>
2017-03-15 11:35:55 +01:00
..
bsd_mount_parser_test.rb Add FreeBSD support for ZFS datasets and pools 2017-02-22 10:29:49 -07:00
filter_array_test.rb unit test FilterArray, make retrieved values unique 2016-02-09 11:51:52 +01:00
filter_table_test.rb bugfix: support nil entries in filter table 2016-10-05 13:04:00 +02:00
find_files_test.rb fix optional type argument handling 2015-12-04 14:27:32 +01:00
object_traversal_test.rb Fix ObjectTraverser when accessing array values 2017-03-15 11:35:55 +01:00
passwd_parser_test.rb Ignore comment lines in /etc/passwd 2016-08-16 10:54:52 +02:00
simpleconfig_test.rb move simple_config_test.rb to utils/ 2016-02-09 11:51:52 +01:00
solaris_netstat_parser.rb parse port information on solaris 10 and 11 via netstat 2016-01-28 18:30:38 +01:00