]> gitweb.fluxo.info Git - puppet-stdlib.git/commitdiff
(#14670) Fixup file_line autorequire specs
authorJeff McCune <jeff@puppetlabs.com>
Mon, 26 Nov 2012 19:37:08 +0000 (11:37 -0800)
committerJeff McCune <jeff@puppetlabs.com>
Mon, 26 Nov 2012 19:37:08 +0000 (11:37 -0800)
Without this patch applied the file_line autorequire examples are
failing.  This is a problem because the failures are false positives and
should be passing given the implementation.

This patch fixes the problem by changing the examples to directly test
the existence of the relationship by finding it in the list of
autorequire relationships.

spec/unit/puppet/type/file_line_spec.rb

index 1fa8e8462286f60ce2f5855ff77eb6c73798fc71..0cd8a262d2b9faa0f6687044b5deca857d969d77 100644 (file)
@@ -54,17 +54,16 @@ describe Puppet::Type.type(:file_line) do
     file = Puppet::Type.type(:file).new(:name => "/tmp/path")
     catalog.add_resource file
     catalog.add_resource file_line
-    reqs = file_line.autorequire
-    reqs.size.should eq 1
-    reqs[0].source.should eq file
-    reqs[0].target.should eq file_line
+
+    relationship = file_line.autorequire.find do |rel|
+      (rel.source.to_s == "File[/tmp/path]") and (rel.target.to_s == file_line.to_s)
+    end
+    relationship.should be_a Puppet::Relationship
   end
 
   it "should not autorequire the file it manages if it is not managed" do
     catalog = Puppet::Resource::Catalog.new
     catalog.add_resource file_line
-    reqs = file_line.autorequire
-    reqs.size.should eq 0
+    file_line.autorequire.should be_empty
   end
-
 end