aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/std_ext/test_unit_ext.rb
blob: abba7f5ff88531c3d2e5b38562983bf768053eb0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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