Sha256: 9bf0f6f86c8ad4274d245c289dafac28df98e7a47d7297bddb9c111dd0a4b5d8

Contents?: true

Size: 1.59 KB

Versions: 468

Compression:

Stored size: 1.59 KB

Contents

require 'spec_helper'
require 'puppet/pops'
require 'puppet/parser/parser_factory'
require 'puppet_spec/compiler'
require 'puppet_spec/pops'
require 'puppet_spec/scope'
require 'matchers/resource'

# These tests are in a separate file since othr compiler related tests have
# been dramatically changed between 3.x and 4.x and it is a pain to merge
# them.
#
describe "Puppet::Parser::Compiler when dealing with relative naming" do
  include PuppetSpec::Compiler
  include Matchers::Resource

  describe "the compiler when using 4.x parser and evaluator" do
    it "should use absolute references even if references are not anchored" do
      node = Puppet::Node.new("testnodex")
      catalog = compile_to_catalog(<<-PP, node)
      class foo::thing {
        notify {"from foo::thing":}
      }

      class thing {
        notify {"from ::thing":}
      }

      class foo {
      #  include thing
        class {'thing':}
      }

      include foo
      PP

      catalog = Puppet::Parser::Compiler.compile(node)

      expect(catalog).to have_resource("Notify[from ::thing]")
    end

    it "should use absolute references when references are absolute" do
      node = Puppet::Node.new("testnodex")
      catalog = compile_to_catalog(<<-PP, node)
      class foo::thing {
        notify {"from foo::thing":}
      }

      class thing {
        notify {"from ::thing":}
      }

      class foo {
      #  include thing
        class {'::thing':}
      }

      include foo
      PP

      catalog = Puppet::Parser::Compiler.compile(node)

      expect(catalog).to have_resource("Notify[from ::thing]")
    end
  end
end

Version data entries

468 entries across 468 versions & 1 rubygems

Version Path
puppet-8.3.0 spec/integration/parser/dynamic_scoping_spec.rb
puppet-8.3.0-x86-mingw32 spec/integration/parser/dynamic_scoping_spec.rb
puppet-8.3.0-x64-mingw32 spec/integration/parser/dynamic_scoping_spec.rb
puppet-8.3.0-universal-darwin spec/integration/parser/dynamic_scoping_spec.rb
puppet-8.4.0 spec/integration/parser/dynamic_scoping_spec.rb
puppet-8.4.0-x86-mingw32 spec/integration/parser/dynamic_scoping_spec.rb
puppet-8.4.0-x64-mingw32 spec/integration/parser/dynamic_scoping_spec.rb
puppet-8.4.0-universal-darwin spec/integration/parser/dynamic_scoping_spec.rb
puppet-7.28.0 spec/integration/parser/dynamic_scoping_spec.rb
puppet-7.28.0-x86-mingw32 spec/integration/parser/dynamic_scoping_spec.rb
puppet-7.28.0-x64-mingw32 spec/integration/parser/dynamic_scoping_spec.rb
puppet-7.28.0-universal-darwin spec/integration/parser/dynamic_scoping_spec.rb
puppet-8.3.1 spec/integration/parser/dynamic_scoping_spec.rb
puppet-8.3.1-x86-mingw32 spec/integration/parser/dynamic_scoping_spec.rb
puppet-8.3.1-x64-mingw32 spec/integration/parser/dynamic_scoping_spec.rb
puppet-8.3.1-universal-darwin spec/integration/parser/dynamic_scoping_spec.rb
puppet-7.27.0 spec/integration/parser/dynamic_scoping_spec.rb
puppet-7.27.0-x86-mingw32 spec/integration/parser/dynamic_scoping_spec.rb
puppet-7.27.0-x64-mingw32 spec/integration/parser/dynamic_scoping_spec.rb
puppet-7.27.0-universal-darwin spec/integration/parser/dynamic_scoping_spec.rb