summaryrefslogtreecommitdiffstats
path: root/spec/unit/parser
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-11-23 00:56:38 -0600
committerJames Turnbull <james@lovedthanlost.net>2008-11-25 14:11:00 +1100
commitbbad9831577a123cc5f6bd7f04836f483c9e8f6f (patch)
tree7dd57ec825adbf6a6acba1e999ef3de61802339c /spec/unit/parser
parentb415848841edac9b08ff604416ad2e24dd350b4d (diff)
Removing the included testing gems; you must now install them yourself.
Everything passes, but autotest doesn't include color. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec/unit/parser')
-rwxr-xr-xspec/unit/parser/compiler.rb41
1 files changed, 35 insertions, 6 deletions
diff --git a/spec/unit/parser/compiler.rb b/spec/unit/parser/compiler.rb
index ab430da62..296c8a0b4 100755
--- a/spec/unit/parser/compiler.rb
+++ b/spec/unit/parser/compiler.rb
@@ -2,6 +2,34 @@
require File.dirname(__FILE__) + '/../../spec_helper'
+class CompilerTestResource
+ attr_accessor :builtin, :virtual, :evaluated, :type, :title
+
+ def initialize(type, title)
+ @type = type
+ @title = title
+ end
+
+ def ref
+ "%s[%s]" % [type.to_s.capitalize, title]
+ end
+
+ def evaluated?
+ @evaluated
+ end
+
+ def builtin?
+ @builtin
+ end
+
+ def virtual?
+ @virtual
+ end
+
+ def evaluate
+ end
+end
+
describe Puppet::Parser::Compiler do
before :each do
@node = Puppet::Node.new "testnode"
@@ -164,11 +192,12 @@ describe Puppet::Parser::Compiler do
end
it "should evaluate unevaluated resources" do
- resource = stub 'notevaluated', :ref => "File[testing]", :builtin? => false, :evaluated? => false, :virtual? => false
+ resource = CompilerTestResource.new(:file, "testing")
+
@compiler.add_resource(@scope, resource)
# We have to now mark the resource as evaluated
- resource.expects(:evaluate).with { |*whatever| resource.stubs(:evaluated?).returns true }
+ resource.expects(:evaluate).with { |*whatever| resource.evaluated = true }
@compiler.compile
end
@@ -182,14 +211,14 @@ describe Puppet::Parser::Compiler do
end
it "should evaluate unevaluated resources created by evaluating other resources" do
- resource = stub 'notevaluated', :ref => "File[testing]", :builtin? => false, :evaluated? => false, :virtual? => false
+ resource = CompilerTestResource.new(:file, "testing")
@compiler.add_resource(@scope, resource)
- resource2 = stub 'created', :ref => "File[other]", :builtin? => false, :evaluated? => false, :virtual? => false
+ resource2 = CompilerTestResource.new(:file, "other")
# We have to now mark the resource as evaluated
- resource.expects(:evaluate).with { |*whatever| resource.stubs(:evaluated?).returns(true); @compiler.add_resource(@scope, resource2) }
- resource2.expects(:evaluate).with { |*whatever| resource2.stubs(:evaluated?).returns(true) }
+ resource.expects(:evaluate).with { |*whatever| resource.evaluated = true; @compiler.add_resource(@scope, resource2) }
+ resource2.expects(:evaluate).with { |*whatever| resource2.evaluated = true }
@compiler.compile