summaryrefslogtreecommitdiffstats
path: root/spec/unit/parser
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-02-08 13:54:53 -0800
committerLuke Kanies <luke@madstop.com>2008-02-08 13:54:53 -0800
commitfb4bdc0b02bba1291cb78ccd5c2a3198d3929d69 (patch)
treef23da901542f938f8b299f9608690477934b40c8 /spec/unit/parser
parent5a0e34b4f8da22e1830ec7d0a730c3686665bceb (diff)
downloadpuppet-fb4bdc0b02bba1291cb78ccd5c2a3198d3929d69.tar.gz
puppet-fb4bdc0b02bba1291cb78ccd5c2a3198d3929d69.tar.xz
puppet-fb4bdc0b02bba1291cb78ccd5c2a3198d3929d69.zip
More AST refactoring -- each of the code wrapping classes
just returns a resource from its evaluate() method, and all of the work is done in the evaluate_code method. This makes the code cleaner, because it means 1) evaluate() has the same prototype as all of the other AST classes, 2) evaluate() is no longer called indirectly through the Parser Resource class, and 3) the classes themselves are responsible for creating the resources, rather than it being done in the Compile class.
Diffstat (limited to 'spec/unit/parser')
-rwxr-xr-xspec/unit/parser/ast/definition.rb2
-rwxr-xr-xspec/unit/parser/resource.rb6
2 files changed, 4 insertions, 4 deletions
diff --git a/spec/unit/parser/ast/definition.rb b/spec/unit/parser/ast/definition.rb
index 1c84f5c5f..fae2851e3 100755
--- a/spec/unit/parser/ast/definition.rb
+++ b/spec/unit/parser/ast/definition.rb
@@ -26,7 +26,7 @@ describe Puppet::Parser::AST::Definition, "when evaluating" do
true
end
@definition.stubs(:code).returns(code)
- @definition.evaluate(@scope, @resource)
+ @definition.evaluate_code(@resource)
end
# it "should copy its namespace to the scope"
diff --git a/spec/unit/parser/resource.rb b/spec/unit/parser/resource.rb
index 36e104fb1..099cfd05e 100755
--- a/spec/unit/parser/resource.rb
+++ b/spec/unit/parser/resource.rb
@@ -21,20 +21,20 @@ describe Puppet::Parser::Resource, " when evaluating" do
it "should evaluate the associated AST definition" do
res = @type.new(:type => "mydefine", :title => "whatever", :scope => @scope, :source => @source)
- @definition.expects(:evaluate).with(@scope, res)
+ @definition.expects(:evaluate_code).with(res)
res.evaluate
end
it "should evaluate the associated AST class" do
res = @type.new(:type => "class", :title => "myclass", :scope => @scope, :source => @source)
- @class.expects(:evaluate).with(@scope, res)
+ @class.expects(:evaluate_code).with(res)
res.evaluate
end
it "should evaluate the associated AST node" do
res = @type.new(:type => "node", :title => "mynode", :scope => @scope, :source => @source)
- @nodedef.expects(:evaluate).with(@scope, res)
+ @nodedef.expects(:evaluate_code).with(res)
res.evaluate
end
end