lib/zentest.rb in ZenTest-4.0.0 vs lib/zentest.rb in ZenTest-4.1.0
- old
+ new
@@ -1,11 +1,13 @@
-require 'zentest_mapping'
-
$stdlib = {}
-ObjectSpace.each_object(Module) { |m| $stdlib[m.name] = true }
+ObjectSpace.each_object(Module) do |m|
+ $stdlib[m.name] = true if m.respond_to? :name
+end
+require 'zentest_mapping'
+
$:.unshift( *$I.split(/:/) ) if defined? $I and String === $I
$r = false unless defined? $r # reverse mapping for testclass names
if $r then
# all this is needed because rails is retarded
@@ -15,11 +17,10 @@
require 'config/environment'
f = './app/controllers/application.rb'
require f if test ?f, f
end
-$ZENTEST = true
$TESTING = true
class Module
def zentest
at_exit { ZenTest.autotest(self) }
@@ -50,11 +51,11 @@
#
# See ZenTestMapping for documentation on method naming.
class ZenTest
- VERSION = '4.0.0'
+ VERSION = '4.1.0'
include ZenTestMapping
if $TESTING then
attr_reader :missing_methods
@@ -473,10 +474,11 @@
@result.push "# found test classes: #{@test_klasses.keys.join(', ')}"
end
if @missing_methods.size > 0 then
@result.push ""
- @result.push "require 'test/unit' unless defined? $ZENTEST and $ZENTEST"
+ @result.push "require 'test/unit/testcase'"
+ @result.push "require 'test/unit' if $0 == __FILE__"
@result.push ""
end
indentunit = " "