inspec/docs/resources/csv.md.erb
hannah-radish 9cfc86d2ab Resource documentation update (#2207)
Light formatting changes, change order of example and matchers, slight
color changes

Signed-off-by: hannah-radish <hmaddy@chef.io>
2017-10-03 17:35:10 -04:00

47 lines
1 KiB
Text

---
title: About the csv Resource
---
# csv
Use the `csv` InSpec audit resource to test configuration data in a CSV file.
<br>
## Syntax
A `csv` resource block declares the configuration data to be tested:
describe csv('file') do
its('name') { should eq 'foo' }
end
where
* `'file'` is the path to a CSV file
* `name` is a configuration setting in a CSV file
* `should eq 'foo'` tests a value of `name` as read from a CSV file versus the value declared in the test
<br>
## Examples
The following examples show how to use this InSpec audit resource.
### Test a CSV file
describe csv('some_file.csv') do
its('setting') { should eq 1 }
end
<br>
## Matchers
This InSpec audit resource has the following matchers. For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
### name
The `name` matcher tests the value of `name` as read from a CSV file versus the value declared in the test:
its('name') { should eq 'foo' }