summaryrefslogtreecommitdiffstats
path: root/spec/unit
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
parentb415848841edac9b08ff604416ad2e24dd350b4d (diff)
downloadpuppet-bbad9831577a123cc5f6bd7f04836f483c9e8f6f.tar.gz
puppet-bbad9831577a123cc5f6bd7f04836f483c9e8f6f.tar.xz
puppet-bbad9831577a123cc5f6bd7f04836f483c9e8f6f.zip
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')
-rwxr-xr-x[-rw-r--r--]spec/unit/network/xmlrpc/client.rb0
-rwxr-xr-xspec/unit/node/catalog.rb18
-rwxr-xr-xspec/unit/parser/compiler.rb41
-rwxr-xr-xspec/unit/util/settings.rb4
-rwxr-xr-xspec/unit/util/storage.rb4
5 files changed, 52 insertions, 15 deletions
diff --git a/spec/unit/network/xmlrpc/client.rb b/spec/unit/network/xmlrpc/client.rb
index a0a2e77fb..a0a2e77fb 100644..100755
--- a/spec/unit/network/xmlrpc/client.rb
+++ b/spec/unit/network/xmlrpc/client.rb
diff --git a/spec/unit/node/catalog.rb b/spec/unit/node/catalog.rb
index 45174e5e5..be198b88e 100755
--- a/spec/unit/node/catalog.rb
+++ b/spec/unit/node/catalog.rb
@@ -152,7 +152,7 @@ describe Puppet::Node::Catalog, " when extracting transobjects" do
end
describe Puppet::Node::Catalog, " when converting to a transobject catalog" do
- class TestResource
+ class CatalogTestResource
attr_accessor :name, :virtual, :builtin
def initialize(name, options = {})
@name = name
@@ -185,14 +185,14 @@ describe Puppet::Node::Catalog, " when converting to a transobject catalog" do
@original.tag(*%w{one two three})
@original.add_class *%w{four five six}
- @top = TestResource.new 'top'
- @topobject = TestResource.new 'topobject', :builtin => true
- @virtual = TestResource.new 'virtual', :virtual => true
- @virtualobject = TestResource.new 'virtualobject', :builtin => true, :virtual => true
- @middle = TestResource.new 'middle'
- @middleobject = TestResource.new 'middleobject', :builtin => true
- @bottom = TestResource.new 'bottom'
- @bottomobject = TestResource.new 'bottomobject', :builtin => true
+ @top = CatalogTestResource.new 'top'
+ @topobject = CatalogTestResource.new 'topobject', :builtin => true
+ @virtual = CatalogTestResource.new 'virtual', :virtual => true
+ @virtualobject = CatalogTestResource.new 'virtualobject', :builtin => true, :virtual => true
+ @middle = CatalogTestResource.new 'middle'
+ @middleobject = CatalogTestResource.new 'middleobject', :builtin => true
+ @bottom = CatalogTestResource.new 'bottom'
+ @bottomobject = CatalogTestResource.new 'bottomobject', :builtin => true
@resources = [@top, @topobject, @middle, @middleobject, @bottom, @bottomobject]
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
diff --git a/spec/unit/util/settings.rb b/spec/unit/util/settings.rb
index 313042d65..915d13c7c 100755
--- a/spec/unit/util/settings.rb
+++ b/spec/unit/util/settings.rb
@@ -486,6 +486,10 @@ describe Puppet::Util::Settings do
@settings.setdefaults :files, :myfile => {:default => "/myfile", :desc => "a", :mode => 0755}
end
+ after do
+ Puppet::Type.type(:file).clear
+ end
+
def stub_transaction
@bucket = mock 'bucket'
@config = mock 'config', :clear => nil
diff --git a/spec/unit/util/storage.rb b/spec/unit/util/storage.rb
index b2c350267..eb495bc0b 100755
--- a/spec/unit/util/storage.rb
+++ b/spec/unit/util/storage.rb
@@ -15,6 +15,10 @@ describe Puppet::Util::Storage do
before(:each) do
Puppet::Util::Storage.clear()
end
+
+ after do
+ Puppet::Type.type(:file).clear
+ end
describe "when caching a symbol" do
it "should return an empty hash" do