From 00fb4dd2a38d6001ea9fa0e16735254085e7241b Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sat, 25 Apr 2020 00:19:01 +0900 Subject: [PATCH 1/2] Should teardown in reverse order of setup --- test/rdoc/test_rdoc_parser_changelog.rb | 2 ++ test/rdoc/test_rdoc_ri_driver.rb | 4 ++-- test/rdoc/test_rdoc_ri_paths.rb | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/test/rdoc/test_rdoc_parser_changelog.rb b/test/rdoc/test_rdoc_parser_changelog.rb index cb6406259c..d93cb7deca 100644 --- a/test/rdoc/test_rdoc_parser_changelog.rb +++ b/test/rdoc/test_rdoc_parser_changelog.rb @@ -14,6 +14,8 @@ def setup def teardown @tempfile.close! + + super end def test_class_can_parse diff --git a/test/rdoc/test_rdoc_ri_driver.rb b/test/rdoc/test_rdoc_ri_driver.rb index 1a8ac3dde5..e62323338b 100644 --- a/test/rdoc/test_rdoc_ri_driver.rb +++ b/test/rdoc/test_rdoc_ri_driver.rb @@ -33,11 +33,11 @@ def setup end def teardown - super - ENV['HOME'] = @orig_home ENV['RI'] = @orig_ri FileUtils.rm_rf @tmpdir + + super end DUMMY_PAGER = ":;\n" diff --git a/test/rdoc/test_rdoc_ri_paths.rb b/test/rdoc/test_rdoc_ri_paths.rb index 726922daf0..78e1a04f73 100644 --- a/test/rdoc/test_rdoc_ri_paths.rb +++ b/test/rdoc/test_rdoc_ri_paths.rb @@ -36,12 +36,12 @@ def setup end def teardown - super - Gem.use_paths(*@orig_gem_path) Gem::Specification.reset FileUtils.rm_rf @tempdir ENV.replace(@orig_env) + + super end def test_class_each From 6c4801d1f645a7172ca0ef85496fab5dd39254ed Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sat, 25 Apr 2020 01:43:38 +0900 Subject: [PATCH 2/2] HOME is preserved by RDoc::TestCase --- test/rdoc/test_rdoc_markdown.rb | 2 ++ test/rdoc/test_rdoc_ri_driver.rb | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/rdoc/test_rdoc_markdown.rb b/test/rdoc/test_rdoc_markdown.rb index 021d94297b..9c7a406224 100644 --- a/test/rdoc/test_rdoc_markdown.rb +++ b/test/rdoc/test_rdoc_markdown.rb @@ -8,6 +8,8 @@ class TestRDocMarkdown < RDoc::TestCase def setup + super + @RM = RDoc::Markup @parser = RDoc::Markdown.new diff --git a/test/rdoc/test_rdoc_ri_driver.rb b/test/rdoc/test_rdoc_ri_driver.rb index e62323338b..f79d17b1cd 100644 --- a/test/rdoc/test_rdoc_ri_driver.rb +++ b/test/rdoc/test_rdoc_ri_driver.rb @@ -13,7 +13,6 @@ def setup FileUtils.mkdir_p @home_ri @orig_ri = ENV['RI'] - @orig_home = ENV['HOME'] ENV['HOME'] = @tmpdir @rdoc_home = File.join ENV["HOME"], ".rdoc" FileUtils.mkdir_p @rdoc_home @@ -33,7 +32,6 @@ def setup end def teardown - ENV['HOME'] = @orig_home ENV['RI'] = @orig_ri FileUtils.rm_rf @tmpdir