File: export_resource_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 (36 lines) | stat: -rw-r--r-- 1,007 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
30
31
32
33
34
35
36
# frozen_string_literal: true

require 'spec_helper'

describe 'export_resource' do
  describe 'exported_resources accessor' do
    it 'supports the contain_* matcher' do
      expect(exported_resources).to contain_file('/exported/resource')
        .with_content('Exported Content')
    end

    it 'supports the have_*_resource_count matcher' do
      expect(exported_resources).to have_file_resource_count(1)
    end
  end

  describe 'exported_resources sub-context' do
    subject { exported_resources }

    it 'supports the contain_* matcher' do
      expect(subject).to contain_file('/exported/resource')
        .with_content('Exported Content')
    end

    it 'supports the have_*_resource_count matcher' do
      expect(subject).to have_file_resource_count(1)
    end
  end

  describe 'normal catalogue tests' do
    it 'does not match exported resources' do
      expect(subject).not_to contain_file('/exported/resource')
      expect(subject).to have_file_resource_count(0)
    end
  end
end