Added run time fix for the test/unit problems with Ruby 1.8.2

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@360 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
David Heinemeier Hansson 2005-01-10 00:19:17 +00:00
parent 9041caadb4
commit 7027fb8950
1 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,24 @@
# Bug fix for using Ruby 1.8.2 and Rake together to run tests.
require 'test/unit'
module Test
module Unit
module Collector
class Dir
def collect_file(name, suites, already_gathered)
dir = File.dirname(File.expand_path(name))
$:.unshift(dir) unless $:.first == dir
if(@req)
@req.require(name)
else
require(name)
end
find_test_cases(already_gathered).each{|t| add_suite(suites, t.suite)}
rescue LoadError, SystemExit
ensure
$:.delete_at $:.rindex(dir)
end
end
end
end
end