summaryrefslogtreecommitdiffstats
path: root/spec/unit/parser
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/parser')
-rwxr-xr-xspec/unit/parser/compile.rb10
-rwxr-xr-xspec/unit/parser/interpreter.rb23
2 files changed, 12 insertions, 21 deletions
diff --git a/spec/unit/parser/compile.rb b/spec/unit/parser/compile.rb
index f6b3c9b3f..8bfcdd495 100755
--- a/spec/unit/parser/compile.rb
+++ b/spec/unit/parser/compile.rb
@@ -49,4 +49,14 @@ describe Puppet::Parser::Compile, " when compiling" do
@compile.resources.find { |r| r.to_s == "Class[two]" }.should be_nil
@compile.resources.find { |r| r.to_s == "Class[four]" }.should be_nil
end
+
+ it "should enable ast_nodes if the parser has any nodes" do
+ @parser.expects(:nodes).returns(:one => :yay)
+ @compile.ast_nodes?.should be_true
+ end
+
+ it "should disable ast_nodes if the parser has no nodes" do
+ @parser.expects(:nodes).returns({})
+ @compile.ast_nodes?.should be_false
+ end
end
diff --git a/spec/unit/parser/interpreter.rb b/spec/unit/parser/interpreter.rb
index b4aa2a2d1..fbf3bdb23 100755
--- a/spec/unit/parser/interpreter.rb
+++ b/spec/unit/parser/interpreter.rb
@@ -24,16 +24,6 @@ describe Puppet::Parser::Interpreter, " when initializing" do
interp.code.should equal(:code)
interp.file.should be_nil
end
-
- it "should default to usenodes" do
- interp = Puppet::Parser::Interpreter.new
- interp.usenodes?.should be_true
- end
-
- it "should allow disabling of usenodes" do
- interp = Puppet::Parser::Interpreter.new :UseNodes => false
- interp.usenodes?.should be_false
- end
end
describe Puppet::Parser::Interpreter, " when creating parser instances" do
@@ -159,22 +149,13 @@ describe Puppet::Parser::Interpreter, " when compiling configurations" do
@parser = mock 'parser'
end
- it "should create a compile with the node, parser, and whether to use ast nodes when ast nodes is true" do
+ it "should create a compile with the node and parser" do
@compile.expects(:compile).returns(:config)
@interp.expects(:parser).with(:myenv).returns(@parser)
- @interp.expects(:usenodes?).returns(true)
- Puppet::Parser::Compile.expects(:new).with(@node, @parser, :ast_nodes => true).returns(@compile)
+ Puppet::Parser::Compile.expects(:new).with(@node, @parser).returns(@compile)
@interp.compile(@node)
end
- it "should create a compile with the node, parser, and whether to use ast nodes when ast nodes is false" do
- @compile.expects(:compile).returns(:config)
- @interp.expects(:parser).with(:myenv).returns(@parser)
- @interp.expects(:usenodes?).returns(false)
- Puppet::Parser::Compile.expects(:new).with(@node, @parser, :ast_nodes => false).returns(@compile)
- @interp.compile(@node).should equal(:config)
- end
-
it "should fail intelligently when no parser can be found" do
@interp.expects(:parser).with(:myenv).returns(nil)
proc { @interp.compile(@node) }.should raise_error(Puppet::ParseError)