File: node_params_spec.rb

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 (31 lines) | stat: -rw-r--r-- 911 bytes parent folder | download | duplicates (2)
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
require 'spec_helper'

describe 'node_params', :if => Puppet::Util::Package.versioncmp(Puppet.version, '3.0.0') >= 0 do
  fuzzed = {
    :string => 'foo bar baz',
    :hash => { 'foo' => 'bar', 'baz' => 'foo' },
    :array => %w[baz foo bar],
    :true => true,
    :false => false,
    :integer => 5,
    :float => 4.4,
    :nil => nil
  }

  let(:node_params) { fuzzed }

  it 'compiles into a catalogue without dependency cycles' do
    is_expected.to compile.with_all_deps
    is_expected.to contain_class('node_params')
  end

  fuzzed.each do |title, message|
    it "contains Notify[#{title}] with message => #{message}" do
      is_expected.to contain_notify(title.to_s).with(:message => message)
    end
  end

  it "doesn't leak to the facts hash", :if => Puppet::Util::Package.versioncmp(Puppet.version, '4.0.0') >= 0 do
    is_expected.to contain_notify('stringfact').with(:message => '')
  end
end