Sha256: 169bc745b9764a7f99f66f88cb16cceb826932f093696941d2ed5e603777788d

Contents?: true

Size: 1.03 KB

Versions: 18

Compression:

Stored size: 1.03 KB

Contents

#!/usr/bin/env ruby

require File.dirname(__FILE__) + '/../../../spec_helper'

describe "the 'include' function" do

  before :each do
    Puppet::Node::Environment.stubs(:current).returns(nil)
    @compiler = Puppet::Parser::Compiler.new(Puppet::Node.new("foo"))
    @scope = Puppet::Parser::Scope.new(:compiler => @compiler)
  end

  it "should exist" do
    Puppet::Parser::Functions.function("include").should == "function_include"
  end

  it "should include a single class" do
    inc = "foo"
    @compiler.expects(:evaluate_classes).with {|klasses,parser,lazy| klasses == [inc]}.returns([inc])
    @scope.function_include("foo")
  end

  it "should include multiple classes" do
    inc = ["foo","bar"]
    @compiler.expects(:evaluate_classes).with {|klasses,parser,lazy| klasses == inc}.returns(inc)
    @scope.function_include(["foo","bar"])
  end

  it "should not lazily evaluate the included class" do
    @compiler.expects(:evaluate_classes).with {|klasses,parser,lazy| lazy == false}.returns("foo")
    @scope.function_include("foo")
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
puppet-2.6.18 spec/unit/parser/functions/include_spec.rb
puppet-2.6.17 spec/unit/parser/functions/include_spec.rb
puppet-2.6.16 spec/unit/parser/functions/include_spec.rb
puppet-2.6.15 spec/unit/parser/functions/include_spec.rb
puppet-2.6.14 spec/unit/parser/functions/include_spec.rb
puppet-2.6.13 spec/unit/parser/functions/include_spec.rb
puppet-2.6.12 spec/unit/parser/functions/include_spec.rb
puppet-2.6.11 spec/unit/parser/functions/include_spec.rb
puppet-2.6.10 spec/unit/parser/functions/include_spec.rb
puppet-2.6.9 spec/unit/parser/functions/include_spec.rb
puppet-2.6.8 spec/unit/parser/functions/include_spec.rb
puppet-2.6.7 spec/unit/parser/functions/include_spec.rb
puppet-2.6.6 spec/unit/parser/functions/include_spec.rb
puppet-2.6.5 spec/unit/parser/functions/include_spec.rb
puppet-2.6.4 spec/unit/parser/functions/include_spec.rb
puppet-2.6.3 spec/unit/parser/functions/include_spec.rb
puppet-2.6.2 spec/unit/parser/functions/include_spec.rb
puppet-2.6.1 spec/unit/parser/functions/include_spec.rb