Sha256: 62dfdd17daf14b70fcce8bee10c90c9f9a6bfaba183b289ffb3477b93cd16dbd

Contents?: true

Size: 1.13 KB

Versions: 11

Compression:

Stored size: 1.13 KB

Contents

---
title: About the cran Resource
---

# cran

Use the `cran` InSpec audit resource to test R modules that are installed from CRAN package repository.

## Syntax

A `cran` resource block declares a package and (optionally) a package version:

    describe cran('package_name') do
      it { should be_installed }
    end

where

* `'package_name'` is the name of the package, such as `'DBI'`
* `be_installed` tests to see if the package described above is installed


## Matchers

This InSpec audit resource has the following matchers:

### be_installed

The `be_installed` matcher tests if the named package is installed on the system:

    it { should be_installed }

### version

The `version` matcher tests if the named package version is on the system:

    its('version') { should eq '1.2.3' }

## Examples

The following examples show how to use this InSpec audit resource.

### Test if DBI is installed on the system

    describe cran('DBI') do
      it { should be_installed }
    end

### Test if DBI 0.5.1 is installed on the system

    describe cran('DBI') do
      it { should be_installed }
      its('version') { should eq '0.5.1' }
    end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
inspec-1.51.0 docs/resources/cran.md.erb
inspec-1.50.1 docs/resources/cran.md.erb
inspec-1.49.2 docs/resources/cran.md.erb
inspec-1.48.0 docs/resources/cran.md.erb
inspec-1.47.0 docs/resources/cran.md.erb
inspec-1.46.2 docs/resources/cran.md.erb
inspec-1.45.13 docs/resources/cran.md.erb
inspec-1.45.9 docs/resources/cran.md.erb
inspec-1.44.8 docs/resources/cran.md.erb
inspec-1.43.8 docs/resources/cran.md.erb
inspec-1.43.5 docs/resources/cran.md.erb