Sha256: b6e44e84a289e2b8191f583665da30ce9328f6205678aac8deb40a8c0e4b07c0

Contents?: true

Size: 1.05 KB

Versions: 5

Compression:

Stored size: 1.05 KB

Contents

---
title: About the csv Resource
platform: os
---

# 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 cmp '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>

## Property Examples

### name

The `name` property tests the value of `name` as read from a CSV file compared to the value declared in the test.

    its('name') { should cmp 'foo' }

<br>

## Matchers

For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).


Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
inspec-2.1.81 docs/resources/csv.md.erb
inspec-2.1.21 docs/resources/csv.md.erb
inspec-2.1.10 docs/resources/csv.md.erb
inspec-2.0.32 docs/resources/csv.md.erb
inspec-2.0.17 docs/resources/csv.md.erb