Signed-off-by: Paul Nasrat <[EMAIL PROTECTED]>
---
spec/unit/type/file.rb | 26 ++++++++++++++++++++++----
1 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/spec/unit/type/file.rb b/spec/unit/type/file.rb
index 26a8ff9..9fd6d94 100755
--- a/spec/unit/type/file.rb
+++ b/spec/unit/type/file.rb
@@ -79,6 +79,8 @@ describe Puppet::Type.type(:file) do
before do
@basedir = tempfile
Dir.mkdir(@basedir)
+ @todir = tempfile
+ Dir.mkdir(@todir)
@file = File.join(@basedir, "file")
@link = File.join(@basedir, "link")
@@ -110,13 +112,27 @@ describe Puppet::Type.type(:file) do
("%o" % (File.stat(@file).mode & 007777)).should == "%o" % 0755
end
+ it "should recursively copy directories" do
+ @copy_resource = Puppet.type(:file).create(
+ :path => @todir,
+ :source => @basedir,
+ :ensure => "directory",
+ :recurse => true
+ )
+
+ @catalog.add_resource @copy_resource
+ @catalog.apply
+
+ Dir.entries(@todir).should include("file")
+ Dir.entries(@todir).should include("link")
+ end
+
it "should default to copy dangling symlinks as links" do
- todir = tempfile
- Dir.mkdir(todir)
+
dangling_link = File.join(@basedir, "dangling_link")
File.symlink("/some/where/else", dangling_link)
@symlink_resource = Puppet.type(:file).create(
- :path => todir,
+ :path => @todir,
:source => @basedir,
:ensure => "directory",
:recurse => true
@@ -125,7 +141,9 @@ describe Puppet::Type.type(:file) do
@catalog.add_resource @symlink_resource
@catalog.apply
- Dir.entries(todir).should include ["dangling_link", "file", "link"]
+ Dir.entries(@todir).should include("file")
+ Dir.entries(@todir).should include("link")
+ Dir.entries(@todir).should include("dangling_link")
end
end
end
--
1.5.3.4
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---