summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorJeff McCune <jeff@puppetlabs.com>2012-11-26 11:41:25 -0800
committerJeff McCune <jeff@puppetlabs.com>2012-11-26 11:41:25 -0800
commit9224e370766b71db2793736ed9c74c82aa28d1bf (patch)
tree963e394afd0e22fea49d47c79efd09c8512bf161 /spec
parent8647691c3a51fb343e5115a5eed38541536a0d30 (diff)
parent0648148bfb70159dcf2eb2af3d8e67842ce96f85 (diff)
downloadpuppet-stdlib-9224e370766b71db2793736ed9c74c82aa28d1bf.tar.gz
puppet-stdlib-9224e370766b71db2793736ed9c74c82aa28d1bf.tar.bz2
Merge branch '3.x' into 4.x
* 3.x: (#14670) Fixup file_line autorequire specs (#14670) autorequire a file_line resource's path
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/puppet/type/file_line_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/unit/puppet/type/file_line_spec.rb b/spec/unit/puppet/type/file_line_spec.rb
index e1c07ac..0cd8a26 100644
--- a/spec/unit/puppet/type/file_line_spec.rb
+++ b/spec/unit/puppet/type/file_line_spec.rb
@@ -48,4 +48,22 @@ describe Puppet::Type.type(:file_line) do
it 'should default to ensure => present' do
file_line[:ensure].should eq :present
end
+
+ it "should autorequire the file it manages" do
+ catalog = Puppet::Resource::Catalog.new
+ file = Puppet::Type.type(:file).new(:name => "/tmp/path")
+ catalog.add_resource file
+ catalog.add_resource 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
+ file_line.autorequire.should be_empty
+ end
end