Added autotest support to RubyKoans
authorRene Mendoza <latiendamac@gmail.com>
Fri, 27 Aug 2010 01:14:26 +0000 (20:14 -0500)
committerJim Weirich <jim.weirich@gmail.com>
Fri, 27 Aug 2010 13:38:09 +0000 (09:38 -0400)
Rakefile
src/autotest/discover.rb [new file with mode: 0644]
src/autotest/rubykoan.rb [new file with mode: 0644]

index 614aad6..8fccbbd 100644 (file)
--- a/Rakefile
+++ b/Rakefile
@@ -29,6 +29,8 @@ module Koans
   def Koans.make_koan_file(infile, outfile)
     if infile =~ /edgecase/
       cp infile, outfile
+    elsif infile =~ /autotest/
+      cp_r infile, outfile
     else
       open(infile) do |ins|
         open(outfile, "w") do |outs|
diff --git a/src/autotest/discover.rb b/src/autotest/discover.rb
new file mode 100644 (file)
index 0000000..31a7804
--- /dev/null
@@ -0,0 +1,3 @@
+Autotest.add_discovery do
+  "rubykoan" if File.exist? 'path_to_enlightenment.rb'
+end
diff --git a/src/autotest/rubykoan.rb b/src/autotest/rubykoan.rb
new file mode 100644 (file)
index 0000000..d43dc91
--- /dev/null
@@ -0,0 +1,24 @@
+require 'autotest'
+
+class Autotest::Rubykoan < Autotest
+  def initialize
+    super
+    @exceptions = /\.txt|Rakefile|\.rdoc/
+
+    self.order = :alpha
+    self.add_mapping(/^about_.*rb$/) do |filename, _|
+      filename
+    end 
+
+  end
+
+  def make_test_cmd files_to_test
+    "#{ruby}  'path_to_enlightenment.rb'"
+  end 
+
+  # quiet test/unit chatter
+  def handle_results(results)
+  end
+
+end
+