File: sysctl_before_spec.rb

package info (click to toggle)
ruby-rspec-puppet 4.0.2%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,444 kB
  • sloc: ruby: 6,377; makefile: 6
file content (29 lines) | stat: -rw-r--r-- 810 bytes parent folder | download
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
# frozen_string_literal: true

require 'spec_helper'

describe 'sysctl::before' do
  let(:title) { 'sysctl::before' }
  let(:params) { { value: 'title' } }

  it 'raises an error about needing the sysctl::common class' do
    expect do
      expect(subject).to create_notify('message-title')
        .with_message('This should print if the class is here first.')
    end
      .to raise_error(Puppet::Error, /Could not find resource 'Class\[Sysctl::Common\]/)
  end
end

describe 'sysctl::before' do
  let(:title) { 'test define' }
  let(:pre_condition) do
    ['# we need sysctl common',
     'class {"sysctl::common":}']
  end
  let(:params) { { value: 'title' } }

  it { is_expected.to create_sysctl__before('test define').with_value('title') }

  it { is_expected.to contain_class('sysctl::common') }
end