unit_test (Gem::Validator)

    # File lib/rubygems/validator.rb, line 153
        def unit_test(gem_spec)
         start_dir = Dir.pwd
         Dir.chdir(gem_spec.full_gem_path)
          $: << File.join(Gem.dir, "gems", gem_spec.full_name)
            # XXX: why do we need this gem_spec when we've already got 'spec'?
          test_files = gem_spec.test_files
          if test_files.empty?
            say "There are no unit tests to run for #{gem_spec.full_name}"
            require 'test/unit/ui/console/testrunner'
            return Test::Unit::TestResult.new
          end
          gem gem_spec.name, "= #{gem_spec.version.version}"
          test_files.each do |f| require f end
          suite = Test::Unit::TestSuite.new("#{gem_spec.name}-#{gem_spec.version}")
          ObjectSpace.each_object(Class) do |klass|
            suite << klass.suite if (klass < Test::Unit::TestCase)
          end
          result = TestRunner.run(suite, ui())
          unless result.passed?
            alert_error(result.to_s)
            #unless ask_yes_no(result.to_s + "...keep Gem?", true) then
              #Gem::Uninstaller.new(gem_spec.name, gem_spec.version.version).uninstall
            #end
          end
          result
        ensure
          Dir.chdir(start_dir)
        end