File: include_class.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-- 870 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

module RSpec::Puppet
  module ManifestMatchers
    extend RSpec::Matchers::DSL

    matcher :include_class do |expected_class|
      match do |catalogue|
        RSpec.deprecate('include_class()', replacement: 'contain_class()')
        catalogue.call.classes.include?(expected_class)
      end

      description do
        "include Class[#{expected_class}]"
      end

      if RSpec::Version::STRING < '3'
        failure_message_for_should do |_actual|
          "expected that the catalogue would include Class[#{expected_class}]"
        end
      else
        failure_message do |_actual|
          "expected that the catalogue would include Class[#{expected_class}]"
        end
      end

      def supports_block_expectations
        true
      end

      def supports_value_expectations
        true
      end
    end
  end
end