mirror of
https://github.com/inspec/inspec
synced 2024-11-23 05:03:07 +00:00
Document additional usage of json resource
The `command` and `content` usage seems to have been supported for some time, but is not included in the documentation. ref: * https://github.com/inspec/inspec/pull/1271 Signed-off-by: Sean Escriva <sean.escriva@gmail.com>
This commit is contained in:
parent
e6abd1b23e
commit
b764ced5d9
1 changed files with 15 additions and 0 deletions
|
@ -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
|
||||
|
||||
<br>
|
||||
|
||||
## Examples
|
||||
|
|
Loading…
Reference in a new issue