Sha256: 7821d5ca8d016ee64e874a3dd959f239e15e877cde756fc6ef22ec1cec585111

Contents?: true

Size: 1.1 KB

Versions: 92

Compression:

Stored size: 1.1 KB

Contents

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

describe Puppet::Parser::AST::Node do
  describe "when instantiated" do
    it "should make its names and context available through accessors" do
      node = Puppet::Parser::AST::Node.new(['foo', 'bar'], :line => 5)
      node.names.should == ['foo', 'bar']
      node.context.should == {:line => 5}
    end

    it "should create a node with the proper type, name, context, and module name" do
      node = Puppet::Parser::AST::Node.new(['foo'], :line => 5)
      instantiated_nodes = node.instantiate('modname')
      instantiated_nodes.length.should == 1
      instantiated_nodes[0].type.should == :node
      instantiated_nodes[0].name.should == 'foo'
      instantiated_nodes[0].line.should == 5
      instantiated_nodes[0].module_name.should == 'modname'
    end

    it "should handle multiple names" do
      node = Puppet::Parser::AST::Node.new(['foo', 'bar'])
      instantiated_nodes = node.instantiate('modname')
      instantiated_nodes.length.should == 2
      instantiated_nodes[0].name.should == 'foo'
      instantiated_nodes[1].name.should == 'bar'
    end
  end
end

Version data entries

92 entries across 92 versions & 2 rubygems

Version Path
puppet-3.8.7 spec/unit/parser/ast/node_spec.rb
puppet-3.8.7-x86-mingw32 spec/unit/parser/ast/node_spec.rb
puppet-3.8.7-x64-mingw32 spec/unit/parser/ast/node_spec.rb
puppet-3.8.6 spec/unit/parser/ast/node_spec.rb
puppet-3.8.6-x86-mingw32 spec/unit/parser/ast/node_spec.rb
puppet-3.8.6-x64-mingw32 spec/unit/parser/ast/node_spec.rb
puppet-3.8.5 spec/unit/parser/ast/node_spec.rb
puppet-3.8.5-x86-mingw32 spec/unit/parser/ast/node_spec.rb
puppet-3.8.5-x64-mingw32 spec/unit/parser/ast/node_spec.rb
puppet-3.8.4 spec/unit/parser/ast/node_spec.rb
puppet-3.8.4-x86-mingw32 spec/unit/parser/ast/node_spec.rb
puppet-3.8.4-x64-mingw32 spec/unit/parser/ast/node_spec.rb
puppet-3.8.3 spec/unit/parser/ast/node_spec.rb
puppet-3.8.3-x86-mingw32 spec/unit/parser/ast/node_spec.rb
puppet-3.8.3-x64-mingw32 spec/unit/parser/ast/node_spec.rb
puppet-3.8.2 spec/unit/parser/ast/node_spec.rb
puppet-3.8.2-x86-mingw32 spec/unit/parser/ast/node_spec.rb
puppet-3.8.2-x64-mingw32 spec/unit/parser/ast/node_spec.rb
puppet-3.8.1 spec/unit/parser/ast/node_spec.rb
puppet-3.8.1-x86-mingw32 spec/unit/parser/ast/node_spec.rb