summaryrefslogtreecommitdiffstats
path: root/spec/unit/parser/ast/node_spec.rb
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2010-08-17 12:02:05 -0700
committerJesse Wolfe <jes5199@gmail.com>2010-08-17 12:25:37 -0700
commit16f701edd89a320ad73b5468d883dfb017fe6e96 (patch)
tree0063bdd34139f0ba09be638f8eabf4bf0e596008 /spec/unit/parser/ast/node_spec.rb
parent3c090de39897d85a5d5be20254efcddea14ad8ad (diff)
parent4da88fb4cd57871f16649d50572240ac3f7420f0 (diff)
downloadpuppet-16f701edd89a320ad73b5468d883dfb017fe6e96.tar.gz
puppet-16f701edd89a320ad73b5468d883dfb017fe6e96.tar.xz
puppet-16f701edd89a320ad73b5468d883dfb017fe6e96.zip
Merge remote branch 'paul/4472-4483-4496-4521-4522'
a.k.a. "make_taller_trees"
Diffstat (limited to 'spec/unit/parser/ast/node_spec.rb')
-rw-r--r--spec/unit/parser/ast/node_spec.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/unit/parser/ast/node_spec.rb b/spec/unit/parser/ast/node_spec.rb
new file mode 100644
index 000000000..409e877f9
--- /dev/null
+++ b/spec/unit/parser/ast/node_spec.rb
@@ -0,0 +1,30 @@
+#!/usr/bin/env ruby
+
+require File.dirname(__FILE__) + '/../../../spec_helper'
+
+describe Puppet::Parser::AST::Node do
+ describe "when instantiated" do
+ it "should make its names available through an accessor" do
+ node = Puppet::Parser::AST::Node.new(['foo', 'bar'])
+ node.names.should == ['foo', 'bar']
+ 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