mirror of
https://github.com/inspec/inspec
synced 2024-11-15 01:17:08 +00:00
Merge pull request #647 from chef/chris-rock/fix-docs-json
update documentation for json resource
This commit is contained in:
commit
9c63a8300e
2 changed files with 17 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
"
|
||||
|
||||
|
|
Loading…
Reference in a new issue