[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35

Luke Kanies luke at puppetlabs.com
Wed Jul 14 10:32:25 UTC 2010


The following commit has been merged in the upstream branch:
commit 03532e087946fb4002b218eec477899ffb5860b3
Author: Luke Kanies <luke at puppetlabs.com>
Date:   Mon Apr 12 11:17:52 2010 -0700

    Porting a simple set of tests from test/unit
    
    Signed-off-by: Luke Kanies <luke at puppetlabs.com>

diff --git a/spec/unit/type/file.rb b/spec/unit/type/file.rb
index 64ac135..f9c691b 100755
--- a/spec/unit/type/file.rb
+++ b/spec/unit/type/file.rb
@@ -16,6 +16,25 @@ describe Puppet::Type.type(:file) do
         @file.catalog = @catalog
     end
 
+    describe "when determining if recursion is enabled" do
+        it "should default to recursion being disabled" do
+            @file.should_not be_recurse
+        end
+        [true, "true", 10, "inf", "remote"].each do |value|
+            it "should consider #{value} to enable recursion" do
+                @file[:recurse] = value
+                @file.must be_recurse
+            end
+        end
+
+        [false, "false", 0].each do |value|
+            it "should consider #{value} to disable recursion" do
+                @file[:recurse] = value
+                @file.should_not be_recurse
+            end
+        end
+    end
+
     describe "#write" do
 
         it "should propagate failures encountered when renaming the temporary file" do
diff --git a/test/ral/type/file.rb b/test/ral/type/file.rb
index daa215a..7103766 100755
--- a/test/ral/type/file.rb
+++ b/test/ral/type/file.rb
@@ -378,69 +378,6 @@ class TestFile < Test::Unit::TestCase
         }
     end
 
-    def test_recurse?
-        file = Puppet::Type.type(:file).new :path => tempfile
-
-        # Make sure we default to false
-        assert(! file.recurse?, "Recurse defaulted to true")
-
-        [true, "true", 10, "inf", "remote"].each do |value|
-            file[:recurse] = value
-            assert(file.recurse?, "%s did not cause recursion" % value)
-        end
-
-        [false, "false", 0].each do |value|
-            file[:recurse] = value
-            assert(! file.recurse?, "%s caused recursion" % value)
-        end
-    end
-
-    def test_recursion
-        basedir = tempfile()
-        subdir = File.join(basedir, "subdir")
-        tmpfile = File.join(basedir,"testing")
-        FileUtils.mkdir_p(subdir)
-
-        dir = nil
-        [true, "true", "inf", 50].each do |value|
-            assert_nothing_raised {
-                dir = Puppet::Type.type(:file).new(
-                    :path => basedir,
-                    :recurse => value,
-                    :check => %w{owner mode group}
-                )
-            }
-            config = mk_catalog dir
-            transaction = Puppet::Transaction.new(config)
-
-            children = nil
-
-            assert_nothing_raised {
-                children = transaction.eval_generate(dir)
-            }
-
-            assert_equal([subdir], children.collect {|c| c.title },
-                "Incorrect generated children")
-
-            # Remove our subdir resource,
-            subdir_resource = config.resource(:file, subdir)
-            config.remove_resource(subdir_resource)
-
-            # Create the test file
-            File.open(tmpfile, "w") { |f| f.puts "yayness" }
-
-            assert_nothing_raised {
-                children = transaction.eval_generate(dir)
-            }
-
-            # And make sure we get both resources back.
-            assert_equal([subdir, tmpfile].sort, children.collect {|c| c.title }.sort,
-                "Incorrect generated children when recurse == %s" % value.inspect)
-
-            File.unlink(tmpfile)
-        end
-    end
-
     def test_filetype_retrieval
         file = nil
 

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list