summaryrefslogtreecommitdiff
path: root/test/rdoc/support/test_case.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/rdoc/support/test_case.rb')
-rw-r--r--test/rdoc/support/test_case.rb23
1 files changed, 6 insertions, 17 deletions
diff --git a/test/rdoc/support/test_case.rb b/test/rdoc/support/test_case.rb
index 6d397625e8..d98dbe0d7b 100644
--- a/test/rdoc/support/test_case.rb
+++ b/test/rdoc/support/test_case.rb
@@ -1,16 +1,3 @@
-##
-# RDoc::TestCase is an abstract TestCase to provide common setup and teardown
-# across all RDoc tests. The test case uses minitest, so all the assertions
-# of minitest may be used.
-#
-# The testcase provides the following:
-#
-# * A reset code-object tree
-# * A reset markup preprocessor (RDoc::Markup::PreProcess)
-# * The <code>@RM</code> alias of RDoc::Markup (for less typing)
-# * <code>@pwd</code> containing the current working directory
-# * FileUtils, pp, Tempfile, Dir.tmpdir and StringIO
-
require 'bundler/errors'
begin
gem 'test-unit'
@@ -26,12 +13,12 @@ require 'tempfile'
require 'tmpdir'
require 'stringio'
-require 'rdoc'
+require_relative '../../../lib/rdoc'
##
# RDoc::TestCase is an abstract TestCase to provide common setup and teardown
-# across all RDoc tests. The test case uses minitest, so all the assertions
-# of minitest may be used.
+# across all RDoc tests. The test case uses test-unit, so all the assertions
+# of test-unit may be used.
#
# The testcase provides the following:
#
@@ -50,7 +37,8 @@ class RDoc::TestCase < Test::Unit::TestCase
super
@orig_home = ENV["HOME"]
- ENV["HOME"] = Dir.tmpdir
+ FileUtils.mkdir_p(@test_home = Dir.mktmpdir("test_rdoc_"))
+ ENV["HOME"] = @test_home
@top_level = nil
@@ -77,6 +65,7 @@ class RDoc::TestCase < Test::Unit::TestCase
def teardown
ENV["HOME"] = @orig_home if defined?(@orig_home)
+ defined?(@test_home) and FileUtils.rm_rf @test_home
super
end