Sha256: ea85176e866440e7fd3ee93fcae14f26664080d19c6cf6f56be12dce4d4664b0

Contents?: true

Size: 1.11 KB

Versions: 4

Compression:

Stored size: 1.11 KB

Contents

#! /usr/bin/env ruby -S rspec
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

4 entries across 4 versions & 1 rubygems

Version Path
puppet-3.0.0.rc8 spec/unit/parser/ast/node_spec.rb
puppet-3.0.0.rc7 spec/unit/parser/ast/node_spec.rb
puppet-3.0.0.rc5 spec/unit/parser/ast/node_spec.rb
puppet-3.0.0.rc4 spec/unit/parser/ast/node_spec.rb