summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/puppet/parser/resource.rb2
-rwxr-xr-xspec/unit/parser/resource.rb6
-rwxr-xr-xspec/unit/resource/catalog.rb29
3 files changed, 9 insertions, 28 deletions
diff --git a/lib/puppet/parser/resource.rb b/lib/puppet/parser/resource.rb
index 7dec02b1f..75c885b61 100644
--- a/lib/puppet/parser/resource.rb
+++ b/lib/puppet/parser/resource.rb
@@ -328,7 +328,7 @@ class Puppet::Parser::Resource
# Convert this resource to a RAL resource. We hackishly go via the
# transportable stuff.
def to_type
- to_trans.to_type
+ to_resource.to_type
end
private
diff --git a/spec/unit/parser/resource.rb b/spec/unit/parser/resource.rb
index 37fd44387..5ae8a644a 100755
--- a/spec/unit/parser/resource.rb
+++ b/spec/unit/parser/resource.rb
@@ -64,10 +64,10 @@ describe Puppet::Parser::Resource do
@resource[:one].should == "yay"
end
- it "should have a method for converting to a ral resource" do
- trans = mock 'trans', :to_type => "yay"
+ it "should use a Puppet::Resource for converting to a ral resource" do
+ trans = mock 'resource', :to_type => "yay"
@resource = mkresource
- @resource.expects(:to_trans).returns trans
+ @resource.expects(:to_resource).returns trans
@resource.to_type.should == "yay"
end
diff --git a/spec/unit/resource/catalog.rb b/spec/unit/resource/catalog.rb
index a0b64bc47..44ad25aac 100755
--- a/spec/unit/resource/catalog.rb
+++ b/spec/unit/resource/catalog.rb
@@ -95,35 +95,16 @@ describe Puppet::Resource::Catalog, "when compiling" do
main = mkresource("class", :main)
config.add_vertex(main)
- bucket = mock 'bucket'
- bucket.expects(:classes=).with(config.classes)
+ bucket = stub 'bucket', :file= => nil, :line= => nil, :classes= => nil
+ bucket.expects(:type=).with("Class")
+ bucket.expects(:name=).with(:main)
main.stubs(:builtin?).returns(false)
- main.expects(:to_transbucket).returns(bucket)
+
+ Puppet::TransBucket.expects(:new).returns bucket
config.extract_to_transportable.should equal(bucket)
end
- # This isn't really a spec-style test, but I don't know how better to do it.
- it "should transform the resource graph into a tree of TransBuckets and TransObjects" do
- config = Puppet::Resource::Catalog.new("mynode")
-
- @scope = mkscope
- @source = mock 'source'
-
- defined = mkresource("class", :main)
- builtin = mkresource("file", "/yay")
-
- config.add_edge(defined, builtin)
-
- bucket = []
- bucket.expects(:classes=).with(config.classes)
- defined.stubs(:builtin?).returns(false)
- defined.expects(:to_transbucket).returns(bucket)
- builtin.expects(:to_transobject).returns(:builtin)
-
- config.extract_to_transportable.should == [:builtin]
- end
-
# Now try it with a more complicated graph -- a three tier graph, each tier
it "should transform arbitrarily deep graphs into isomorphic trees" do
config = Puppet::Resource::Catalog.new("mynode")