Commit graph

9 commits

Author SHA1 Message Date
Ryan Davis
07dc5e3192 First pass at cleaning deprecations for old minitest/spec-style tests.
3 files left to go, and they're behaving oddly so I'm leaving them out
in this pass. Looks like 21 deprecations left.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-10-03 13:45:19 -07:00
Miah Johnson
a4f4fe5231 chefstyle -a; https://github.com/chef/chefstyle/pull/74
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-07-08 17:22:50 -07:00
Ryan Davis
a5309ea392 blindly applied chefstyle -a
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-06-11 18:52:03 -07:00
Ryan Davis
be125598c8 Additional whitespace cleanup.
Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-29 17:58:02 -07:00
Ryan Davis
adaf2bc364 Removed aws resource requiring from test/helper and inspec/resource.
This speeds up parallel unit test runs from a very consistent 2:49 to
a very consistent 1:53, or a 33% reduction.

Signed-off-by: Ryan Davis <zenspider@chef.io>
2019-05-29 17:58:02 -07:00
Miah Johnson
6c19e81a06 Remove authors tags from source files.
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-05-28 12:47:39 -07:00
Miah Johnson
659b4b373a Remove # encoding: utf8 magic comments
Signed-off-by: Miah Johnson <miah@chia-pet.org>
2019-05-07 16:06:23 -07:00
Adam Leff
9d8c53cf31 Support symbol keys in ObjectTraverser (#2221)
As detected in #2036, it is not possible to extract values from
a YAML file if the key is a symbol. This change refactors ObjectTraverser
to support symbol keys before attempting to stringify them.

Signed-off-by: Adam Leff <adam@leff.co>
2017-10-06 19:24:31 +02:00
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