The old fakedata test facility was not playing nicely with the
spec tests; although it looped through all the files failures
in any example file after the first were being ignored because
of the way fakedataparse was interacting with the before blocks.

Signed-off-by: Markus Roberts <[email protected]>
---
 spec/integration/provider/mailalias/aliases.rb  |    8 +++---
 spec/unit/provider/ssh_authorized_key/parsed.rb |    8 +++---
 test/lib/puppettest/support/utils.rb            |   24 +++++++---------------
 3 files changed, 16 insertions(+), 24 deletions(-)

diff --git a/spec/integration/provider/mailalias/aliases.rb 
b/spec/integration/provider/mailalias/aliases.rb
index a01bac2..fde0b00 100755
--- a/spec/integration/provider/mailalias/aliases.rb
+++ b/spec/integration/provider/mailalias/aliases.rb
@@ -17,9 +17,9 @@ describe provider_class do
     end
 
     # #1560
-    it "should be able to parse each example" do
-        fakedata("data/providers/mailalias/aliases").each { |file|
+    PuppetTest.fakedata("data/providers/mailalias/aliases").each { |file|
+        it "should be able to parse the examples in #{file}" do
             fakedataparse(file)
-        }
-    end
+        end
+    }
 end
diff --git a/spec/unit/provider/ssh_authorized_key/parsed.rb 
b/spec/unit/provider/ssh_authorized_key/parsed.rb
index 0f32a6f..a901fd0 100755
--- a/spec/unit/provider/ssh_authorized_key/parsed.rb
+++ b/spec/unit/provider/ssh_authorized_key/parsed.rb
@@ -41,12 +41,12 @@ describe provider_class do
         return text
     end
 
-    it "should be able to parse each example" do
-        fakedata("data/providers/ssh_authorized_key/parsed").each { |file|
+    PuppetTest.fakedata("data/providers/ssh_authorized_key/parsed").each { 
|file|
+        it "should be able to parse example data in #{file}" do
             puts "Parsing %s" % file
             fakedataparse(file)
-        }
-    end
+        end
+    }
 
     it "should be able to generate a basic authorized_keys file" do
         key = mkkey({
diff --git a/test/lib/puppettest/support/utils.rb 
b/test/lib/puppettest/support/utils.rb
index 7491095..655308d 100644
--- a/test/lib/puppettest/support/utils.rb
+++ b/test/lib/puppettest/support/utils.rb
@@ -91,22 +91,6 @@ module PuppetTest::Support::Utils
         return trans
     end
 
-    # If there are any fake data files, retrieve them
-    def fakedata(dir)
-        ary = [basedir, "test"]
-        ary += dir.split("/")
-        dir = File.join(ary)
-
-        unless FileTest.exists?(dir)
-            raise Puppet::DevError, "No fakedata dir %s" % dir
-        end
-        files = Dir.entries(dir).reject { |f| f =~ /^\./ }.collect { |f|
-            File.join(dir, f)
-        }
-
-        return files
-    end
-
     def fakefile(name)
         ary = [PuppetTest.basedir, "test"]
         ary += name.split("/")
@@ -169,4 +153,12 @@ end
 
 module PuppetTest
     include PuppetTest::Support::Utils
+
+    def self.fakedata(dir,pat='*')
+        glob = "#{basedir}/test/#{dir}/#{pat}"
+        files = Dir.glob(glob,File::FNM_PATHNAME)
+        raise Puppet::DevError, "No fakedata matching #{glob}" if files.empty?
+        files
+    end
+
 end
-- 
1.6.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
-~----------~----~----~----~------~----~------~--~---

Reply via email to