summaryrefslogtreecommitdiffstats
path: root/spec/unit/parser/compiler.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-12-02 16:26:54 -0600
committerLuke Kanies <luke@madstop.com>2008-12-02 16:26:54 -0600
commit99a9b5a045af6f1c68619792a45603cbe450652d (patch)
tree579963d464c0529d4e9250f937d495e415f1e867 /spec/unit/parser/compiler.rb
parentf73e13e7464edab73443857d628602b89361c220 (diff)
parent278bfe83015312292360f727d6532a143610db0d (diff)
downloadpuppet-99a9b5a045af6f1c68619792a45603cbe450652d.tar.gz
puppet-99a9b5a045af6f1c68619792a45603cbe450652d.tar.xz
puppet-99a9b5a045af6f1c68619792a45603cbe450652d.zip
Merge branch '0.24.x'
Conflicts: bin/puppetca lib/puppet/type/group.rb lib/puppet/type/tidy.rb lib/puppet/util/settings.rb Also edited the following files so tests will pass: lib/puppet/type/component.rb spec/unit/ssl/certificate_request.rb spec/unit/type/computer.rb spec/unit/type/mcx.rb spec/unit/type/resources.rb spec/unit/util/settings.rb spec/unit/util/storage.rb test/ral/type/zone.rb
Diffstat (limited to 'spec/unit/parser/compiler.rb')
-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 c70fe8e13..bf50d8790 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