aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-01-10 00:19:17 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-01-10 00:19:17 +0000
commit7027fb8950096bccb441e680e63263ab9e9f225d (patch)
treea07cee850c4c0823621c7fd52840f3af1e76ef91
parent9041caadb4cc501f964b36447fdd456143003ff7 (diff)
downloadrails-7027fb8950096bccb441e680e63263ab9e9f225d.tar.gz
rails-7027fb8950096bccb441e680e63263ab9e9f225d.tar.bz2
rails-7027fb8950096bccb441e680e63263ab9e9f225d.zip
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
-rw-r--r--activesupport/lib/std_ext/test_unit_ext.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/activesupport/lib/std_ext/test_unit_ext.rb b/activesupport/lib/std_ext/test_unit_ext.rb
new file mode 100644
index 0000000000..abba7f5ff8
--- /dev/null
+++ b/activesupport/lib/std_ext/test_unit_ext.rb
@@ -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