Skip to content

Commit d8cde95

Browse files
author
Jeff McCune
committed
(#14670) Fixup file_line autorequire specs
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.
1 parent dfcee63 commit d8cde95

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

spec/unit/puppet/type/file_line_spec.rb

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,16 @@
5454
file = Puppet::Type.type(:file).new(:name => "/tmp/path")
5555
catalog.add_resource file
5656
catalog.add_resource file_line
57-
reqs = file_line.autorequire
58-
reqs.size.should eq 1
59-
reqs[0].source.should eq file
60-
reqs[0].target.should eq file_line
57+
58+
relationship = file_line.autorequire.find do |rel|
59+
(rel.source.to_s == "File[/tmp/path]") and (rel.target.to_s == file_line.to_s)
60+
end
61+
relationship.should be_a Puppet::Relationship
6162
end
6263

6364
it "should not autorequire the file it manages if it is not managed" do
6465
catalog = Puppet::Resource::Catalog.new
6566
catalog.add_resource file_line
66-
reqs = file_line.autorequire
67-
reqs.size.should eq 0
67+
file_line.autorequire.should be_empty
6868
end
69-
7069
end

0 commit comments

Comments
 (0)