update documentation for json resource

This commit is contained in:
Christoph Hartmann 2016-04-16 07:47:41 -04:00 committed by Dominik Richter
parent dfdae3474d
commit 27357c8630
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
"