Sha256: c25934f1c820653c68b75c9c74bc3d0658d2fcb08520df3e42ed282137e4c6a7

Contents?: true

Size: 1.19 KB

Versions: 42

Compression:

Stored size: 1.19 KB

Contents

---
title: About the cran Resource
platform: linux
---

# cran

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

<br>

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

<br>

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

<br>

## Property Examples

### version

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

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

<br>

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

42 entries across 42 versions & 2 rubygems

Version Path
inspec-core-2.2.55 docs/resources/cran.md.erb
inspec-2.2.55 docs/resources/cran.md.erb
inspec-core-2.2.54 docs/resources/cran.md.erb
inspec-2.2.54 docs/resources/cran.md.erb
inspec-core-2.2.50 docs/resources/cran.md.erb
inspec-2.2.50 docs/resources/cran.md.erb
inspec-core-2.2.41 docs/resources/cran.md.erb
inspec-2.2.41 docs/resources/cran.md.erb
inspec-core-2.2.35 docs/resources/cran.md.erb
inspec-2.2.35 docs/resources/cran.md.erb
inspec-core-2.2.34 docs/resources/cran.md.erb
inspec-2.2.34 docs/resources/cran.md.erb
inspec-core-2.2.27 docs/resources/cran.md.erb
inspec-2.2.27 docs/resources/cran.md.erb
inspec-core-2.2.20 docs/resources/cran.md.erb
inspec-2.2.20 docs/resources/cran.md.erb
inspec-core-2.2.16 docs/resources/cran.md.erb
inspec-2.2.16 docs/resources/cran.md.erb
inspec-core-2.2.10 docs/resources/cran.md.erb
inspec-2.2.10 docs/resources/cran.md.erb