diff --git a/docs/resources/json.md.erb b/docs/resources/json.md.erb index 54db7799c..704e66762 100644 --- a/docs/resources/json.md.erb +++ b/docs/resources/json.md.erb @@ -47,6 +47,21 @@ where * `name` is a configuration setting in a JSON file * `should eq 'foo'` tests a value of `name` as read from a JSON file versus the value declared in the test +The `json` resource can also be used with json formatted output from a command. +Using the same json as the previous exmaple, it can be queried using: + + describe json({ command: 'retrieve_data.py --json'}) do + its('name') { should eq 'hello' } + its(['meta','creator']) { should eq 'John Doe' } + its(['array', 1]) { should eq 'one' } + end + +Finally content can be passed directly to the resource: + + describe json({ content: '{\"item1\": { \"status\": \"available\" } }' }) do + its(['item1', 'status']) { should cmp 'available' } + end +
## Examples