mirror of
https://github.com/inspec/inspec
synced 2024-11-23 13:13:22 +00:00
update documentation for json resource
This commit is contained in:
parent
dfdae3474d
commit
27357c8630
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