Merge pull request #647 from chef/chris-rock/fix-docs-json

update documentation for json resource
This commit is contained in:
Dominik Richter 2016-04-16 20:31:04 -04:00
commit 9c63a8300e
2 changed files with 17 additions and 4 deletions

View file

@ -1872,12 +1872,25 @@ Use the ``json`` |inspec resource| to test data in a |json| file.
Syntax
-----------------------------------------------------
A ``json`` |inspec resource| block declares the data to be tested:
A ``json`` |inspec resource| block declares the data to be tested. Assume the following json file:
.. code-block:: json
{
"name" : "hello",
"meta" : {
"creator" : "John Doe"
}
}
This file can be queried via:
.. code-block:: ruby
describe json do
its('name') { should eq 'foo' }
describe json('/paht/to/name.json') do
its('name') { should eq 'hello' }
its(['meta','creator']) { should eq 'John Doe' }
end
where

View file

@ -10,7 +10,7 @@ module Inspec::Resources
desc 'Use the json InSpec audit resource to test data in a JSON file.'
example "
describe json('policyfile.lock.json') do
its('cookbook_locks.omnibus.version') { should eq('2.2.0') }
its(['cookbook_locks','omnibus','version']) { should eq('2.2.0') }
end
"