summaryrefslogtreecommitdiffstats
path: root/spec/unit/parser
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-02-08 14:25:52 -0600
committerLuke Kanies <luke@madstop.com>2008-02-08 14:25:52 -0600
commit5a0e34b4f8da22e1830ec7d0a730c3686665bceb (patch)
treed8635f754c2a0fee69e103cf6d85792ff4e736a1 /spec/unit/parser
parent82720d5327b30839a29035ee0b498b940ffc7a5a (diff)
downloadpuppet-5a0e34b4f8da22e1830ec7d0a730c3686665bceb.tar.gz
puppet-5a0e34b4f8da22e1830ec7d0a730c3686665bceb.tar.xz
puppet-5a0e34b4f8da22e1830ec7d0a730c3686665bceb.zip
Refactoring the AST classes just a bit. I realized that
all of the evaluate() methods only ever accepted a scope, and sometimes one other option, so I switched them all to use named arguments instead of a hash.
Diffstat (limited to 'spec/unit/parser')
-rwxr-xr-xspec/unit/parser/ast/definition.rb6
-rwxr-xr-xspec/unit/parser/resource.rb6
2 files changed, 6 insertions, 6 deletions
diff --git a/spec/unit/parser/ast/definition.rb b/spec/unit/parser/ast/definition.rb
index a27fb4721..1c84f5c5f 100755
--- a/spec/unit/parser/ast/definition.rb
+++ b/spec/unit/parser/ast/definition.rb
@@ -21,12 +21,12 @@ describe Puppet::Parser::AST::Definition, "when evaluating" do
it "should create a new scope" do
scope = nil
code = mock 'code'
- code.expects(:safeevaluate).with do |options|
- options[:scope].object_id.should_not == @scope.object_id
+ code.expects(:safeevaluate).with do |scope|
+ scope.object_id.should_not == @scope.object_id
true
end
@definition.stubs(:code).returns(code)
- @definition.evaluate(:scope => @scope, :resource => @resource)
+ @definition.evaluate(@scope, @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 319d8f7d8..36e104fb1 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 => @scope, :resource => res)
+ @definition.expects(:evaluate).with(@scope, 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 => @scope, :resource => res)
+ @class.expects(:evaluate).with(@scope, 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 => @scope, :resource => res)
+ @nodedef.expects(:evaluate).with(@scope, res)
res.evaluate
end
end