Sha256: 81bb6f6b7215741ca3c5938956823a0c5be9fcb843239d043a43c16fa040412c

Contents?: true

Size: 1.11 KB

Versions: 52

Compression:

Stored size: 1.11 KB

Contents

---
title: About the csv Resource
---

# csv

Use the `csv` InSpec audit resource to test configuration data in a CSV file.

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


## Matchers

This InSpec audit resource has the following matchers:

### be

<%= partial "/shared/matcher_be" %>

### cmp

<%= partial "/shared/matcher_cmp" %>

### eq

<%= partial "/shared/matcher_eq" %>

### include

<%= partial "/shared/matcher_include" %>

### match

<%= partial "/shared/matcher_match" %>

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

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

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
inspec-1.40.0 docs/resources/csv.md.erb
inspec-1.39.1 docs/resources/csv.md.erb
inspec-1.38.8 docs/resources/csv.md.erb
inspec-1.37.6 docs/resources/csv.md.erb
inspec-1.36.1 docs/resources/csv.md.erb
inspec-1.35.1 docs/resources/csv.md.erb
inspec-1.34.1 docs/resources/csv.md.erb
inspec-1.33.12 docs/resources/csv.md.erb
inspec-1.33.1 docs/resources/csv.md.erb
inspec-1.32.1 docs/resources/csv.md.erb
inspec-1.31.1 docs/resources/csv.md.erb
inspec-1.31.0 docs/resources/csv.md.erb
inspec-1.30.0 docs/resources/csv.md.erb
inspec-1.29.0 docs/resources/csv.md.erb
inspec-1.28.1 docs/resources/csv.md.erb
inspec-1.28.0 docs/resources/csv.md.erb
inspec-1.27.0 docs/resources/csv.md.erb
inspec-1.26.0 docs/resources/csv.md.erb
inspec-1.25.1 docs/resources/csv.md.erb
inspec-1.25.0 docs/resources/csv.md.erb