commit 3a00ed468617c17b5a527c68cfc37d7d1fddaa72
Author: Chris Boot <crb@tiger-computing.co.uk>
Date:   Thu Mar 14 19:05:50 2013 +0000

    Update Puppet::FileServing::Metadata tests
    
    Provide a stub for resource[:links] => :manage
    Expect :find to be called with :links => :manage

--- a/spec/unit/type/file/source_spec.rb
+++ b/spec/unit/type/file/source_spec.rb
@@ -92,6 +92,7 @@
   describe "when returning the metadata" do
     before do
       @metadata = stub 'metadata', :source= => nil
+      @resource.stubs(:[]).with(:links).returns :manage
     end
 
     it "should return already-available metadata" do
@@ -107,22 +108,22 @@
 
     it "should collect its metadata using the Metadata class if it is not already set" do
       @source = source.new(:resource => @resource, :value => @foobar)
-      Puppet::FileServing::Metadata.indirection.expects(:find).with(@foobar_uri).returns @metadata
+      Puppet::FileServing::Metadata.indirection.expects(:find).with(@foobar_uri, :links => :manage).returns @metadata
       @source.metadata
     end
 
     it "should use the metadata from the first found source" do
       metadata = stub 'metadata', :source= => nil
       @source = source.new(:resource => @resource, :value => [@foobar, @feebooz])
-      Puppet::FileServing::Metadata.indirection.expects(:find).with(@foobar_uri).returns nil
-      Puppet::FileServing::Metadata.indirection.expects(:find).with(@feebooz_uri).returns metadata
+      Puppet::FileServing::Metadata.indirection.expects(:find).with(@foobar_uri, :links => :manage).returns nil
+      Puppet::FileServing::Metadata.indirection.expects(:find).with(@feebooz_uri, :links => :manage).returns metadata
       @source.metadata.should equal(metadata)
     end
 
     it "should store the found source as the metadata's source" do
       metadata = mock 'metadata'
       @source = source.new(:resource => @resource, :value => @foobar)
-      Puppet::FileServing::Metadata.indirection.expects(:find).with(@foobar_uri).returns metadata
+      Puppet::FileServing::Metadata.indirection.expects(:find).with(@foobar_uri, :links => :manage).returns metadata
 
       metadata.expects(:source=).with(@foobar_uri)
       @source.metadata
@@ -130,7 +131,7 @@
 
     it "should fail intelligently if an exception is encountered while querying for metadata" do
       @source = source.new(:resource => @resource, :value => @foobar)
-      Puppet::FileServing::Metadata.indirection.expects(:find).with(@foobar_uri).raises RuntimeError
+      Puppet::FileServing::Metadata.indirection.expects(:find).with(@foobar_uri, :links => :manage).raises RuntimeError
 
       @source.expects(:fail).raises ArgumentError
       lambda { @source.metadata }.should raise_error(ArgumentError)
@@ -138,7 +139,7 @@
 
     it "should fail if no specified sources can be found" do
       @source = source.new(:resource => @resource, :value => @foobar)
-      Puppet::FileServing::Metadata.indirection.expects(:find).with(@foobar_uri).returns nil
+      Puppet::FileServing::Metadata.indirection.expects(:find).with(@foobar_uri, :links => :manage).returns nil
 
       @source.expects(:fail).raises RuntimeError
 
@@ -319,7 +320,7 @@
       before(:each) do
         metadata = Puppet::FileServing::Metadata.new(path, :source => uri, 'type' => 'file')
         #metadata = stub('remote', :ftype => "file", :source => uri)
-        Puppet::FileServing::Metadata.indirection.stubs(:find).with(uri).returns metadata
+        Puppet::FileServing::Metadata.indirection.stubs(:find).with(uri, :links => :manage).returns metadata
         resource[:source] = uri
       end
 
