inspec/docs/resources/directory.md.erb

41 lines
1 KiB
Text
Raw Normal View History

2016-09-22 12:43:57 +00:00
---
title: About the directory Resource
platform: os
2016-09-22 12:43:57 +00:00
---
# directory
Use the `directory` Chef InSpec audit resource to test if the file type is a directory. This is equivalent to using the [`file` resource](https://www.inspec.io/docs/reference/resources/file/) and the `be_directory` matcher, but provides a simpler and more direct way to test directories.
2016-09-22 12:43:57 +00:00
<br>
## Availability
### Installation
This resource is distributed along with Chef InSpec itself. You can use it automatically.
### Version
This resource first became available in v1.0.0 of InSpec.
## Syntax
2016-09-22 12:43:57 +00:00
A `directory` resource block declares the location of the directory to be tested, and then one (or more) matchers.
2016-09-22 12:43:57 +00:00
describe directory('path') do
its('property') { should cmp 'value' }
2016-09-22 12:43:57 +00:00
end
<br>
2016-09-22 12:43:57 +00:00
## Properties
All of the properties available to [`file`](https://www.inspec.io/docs/reference/resources/file/) may be used with `directory`.
<br>
## Matchers
2016-09-22 12:43:57 +00:00
For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).