Sha256: ec3f241853c1fe45f4391fc96071201cbd8be9599e4bf61f483dc9c3d3e73a7b

Contents?: true

Size: 1.42 KB

Versions: 92

Compression:

Stored size: 1.42 KB

Contents

#! /usr/bin/env ruby
require 'spec_helper'

describe "The require function" do
  before :each do
    @node = Puppet::Node.new("mynode")
    @compiler = Puppet::Parser::Compiler.new(@node)

    @compiler.send(:evaluate_main)
    @compiler.catalog.client_version = "0.25"
    @scope = @compiler.topscope
    # preload our functions
    Puppet::Parser::Functions.function(:include)
    Puppet::Parser::Functions.function(:require)
  end

  it "should add a dependency between the 'required' class and our class" do
    @compiler.known_resource_types.add Puppet::Resource::Type.new(:hostclass, "requiredclass")

    @scope.function_require(["requiredclass"])
    @scope.resource["require"].should_not be_nil
    ref = @scope.resource["require"].shift
    ref.type.should == "Class"
    ref.title.should == "Requiredclass"
  end

  it "should queue relationships between the 'required' class and our classes" do
    @compiler.known_resource_types.add Puppet::Resource::Type.new(:hostclass, "requiredclass1")
    @compiler.known_resource_types.add Puppet::Resource::Type.new(:hostclass, "requiredclass2")

    @scope.function_require(["requiredclass1"])
    @scope.function_require(["requiredclass2"])

    @scope.resource["require"].should_not be_nil

    (ref1,ref2) = @scope.resource["require"]
    ref1.type.should == "Class"
    ref1.title.should == "Requiredclass1"
    ref2.type.should == "Class"
    ref2.title.should == "Requiredclass2"
  end

end

Version data entries

92 entries across 92 versions & 2 rubygems

Version Path
puppet-3.8.7 spec/integration/parser/functions/require_spec.rb
puppet-3.8.7-x86-mingw32 spec/integration/parser/functions/require_spec.rb
puppet-3.8.7-x64-mingw32 spec/integration/parser/functions/require_spec.rb
puppet-3.8.6 spec/integration/parser/functions/require_spec.rb
puppet-3.8.6-x86-mingw32 spec/integration/parser/functions/require_spec.rb
puppet-3.8.6-x64-mingw32 spec/integration/parser/functions/require_spec.rb
puppet-3.8.5 spec/integration/parser/functions/require_spec.rb
puppet-3.8.5-x86-mingw32 spec/integration/parser/functions/require_spec.rb
puppet-3.8.5-x64-mingw32 spec/integration/parser/functions/require_spec.rb
puppet-3.8.4 spec/integration/parser/functions/require_spec.rb
puppet-3.8.4-x86-mingw32 spec/integration/parser/functions/require_spec.rb
puppet-3.8.4-x64-mingw32 spec/integration/parser/functions/require_spec.rb
puppet-3.8.3 spec/integration/parser/functions/require_spec.rb
puppet-3.8.3-x86-mingw32 spec/integration/parser/functions/require_spec.rb
puppet-3.8.3-x64-mingw32 spec/integration/parser/functions/require_spec.rb
puppet-3.8.2 spec/integration/parser/functions/require_spec.rb
puppet-3.8.2-x86-mingw32 spec/integration/parser/functions/require_spec.rb
puppet-3.8.2-x64-mingw32 spec/integration/parser/functions/require_spec.rb
puppet-3.8.1 spec/integration/parser/functions/require_spec.rb
puppet-3.8.1-x86-mingw32 spec/integration/parser/functions/require_spec.rb