diff options
author | Jeff McCune <jeff@puppetlabs.com> | 2012-11-26 11:39:26 -0800 |
---|---|---|
committer | Jeff McCune <jeff@puppetlabs.com> | 2012-11-26 11:39:26 -0800 |
commit | b55994b2be55c3f03bc089449d07ecef69ec7638 (patch) | |
tree | f96e3c5a7c72ee528473cecf10e2439db49539ba /spec/unit/puppet/type/file_line_spec.rb | |
parent | 6c104e5e3ab8cc01749b52efcfd303d05a0964d4 (diff) | |
parent | d8cde952956e80eeae617469c59a3bbd61336e70 (diff) | |
download | puppet-stdlib-b55994b2be55c3f03bc089449d07ecef69ec7638.tar.gz puppet-stdlib-b55994b2be55c3f03bc089449d07ecef69ec7638.tar.bz2 |
Merge branch 'fun/2.x/14670_file_line_autorequire' into 2.x
* fun/2.x/14670_file_line_autorequire:
(#14670) Fixup file_line autorequire specs
(#14670) autorequire a file_line resource's path
Diffstat (limited to 'spec/unit/puppet/type/file_line_spec.rb')
-rw-r--r-- | spec/unit/puppet/type/file_line_spec.rb | 18 |
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 |