File: index.md

package info (click to toggle)
ruby-rspec-puppet 2.9.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,416 kB
  • sloc: ruby: 6,661; makefile: 6
file content (48 lines) | stat: -rw-r--r-- 937 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
---
layout: base
title: Testing Defined Types
icon: fa fa-copy
breadcrumbs:
    -
        name: Documentation
        path: /documentation/
---

## Basic Test Structure

Tests for defined types should be placed in files under `spec/defines/`. For
example the tests for `apache::vhost` should be in
`spec/defines/apache_vhost_spec.rb`.

{% highlight ruby %}
require 'spec_helper'

describe '<defined type name >' do
  let(:title) { '<namevar/title>' }

  # let(:params) { ... }

  # it { is_expected.to ... }
end
{% endhighlight %}

## Configuring The Tests

### Specifying the title

As when using a defined type, when testing a defined type it must have a title.
This can be specified using `let(:title)`.

{% highlight ruby %}
let(:title ) { 'something' }
{% endhighlight %}

{% include non_host_inputs.md %}

{% include common_inputs.md %}

{% include facts_inputs.md %}

## Testing The Catalogue

{% include catalogue_matchers.md %}