File: class_spec.rb

package info (click to toggle)
puppet 5.5.22-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 21,316 kB
  • sloc: ruby: 254,925; sh: 1,608; xml: 219; makefile: 153; sql: 103
file content (33 lines) | stat: -rw-r--r-- 1,183 bytes parent folder | download | duplicates (4)
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
require 'spec_helper'
require 'puppet_spec/language'

describe "Class expressions" do
  extend PuppetSpec::Language

  produces(
    "class hi { }"                                       => '!defined(Class[hi])',

    "class hi { } include hi"                            => 'defined(Class[hi])',
    "include(hi) class hi { }"                           => 'defined(Class[hi])',

    "class hi { } class { hi: }"                         => 'defined(Class[hi])',
    "class { hi: } class hi { }"                         => 'defined(Class[hi])',

    "class bye { } class hi inherits bye { } include hi" => 'defined(Class[hi]) and defined(Class[bye])')

  produces(<<-EXAMPLE => 'defined(Notify[foo]) and defined(Notify[bar]) and !defined(Notify[foo::bar])')
    class bar { notify { 'bar': } }
    class foo::bar { notify { 'foo::bar': } }
    class foo inherits bar { notify { 'foo': } }

    include foo
  EXAMPLE

  produces(<<-EXAMPLE => 'defined(Notify[foo]) and defined(Notify[bar]) and !defined(Notify[foo::bar])')
    class bar { notify { 'bar': } }
    class foo::bar { notify { 'foo::bar': } }
    class foo inherits ::bar { notify { 'foo': } }

    include foo
  EXAMPLE
end