summaryrefslogtreecommitdiff
path: root/test/rubygems/helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/rubygems/helper.rb')
-rw-r--r--test/rubygems/helper.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/test/rubygems/helper.rb b/test/rubygems/helper.rb
index d97d930476..be9016b831 100644
--- a/test/rubygems/helper.rb
+++ b/test/rubygems/helper.rb
@@ -3,7 +3,7 @@
require 'rubygems'
# If bundler gemspec exists, add to stubs
-bundler_gemspec = File.expand_path("../../../bundler/bundler.gemspec", __FILE__)
+bundler_gemspec = File.expand_path('../../bundler/bundler.gemspec', __dir__)
if File.exist?(bundler_gemspec)
Gem::Specification.dirs.unshift File.dirname(bundler_gemspec)
Gem::Specification.class_variable_set :@@stubs, nil
@@ -302,11 +302,15 @@ class Gem::TestCase < Test::Unit::TestCase
# or <tt>i686-darwin8.10.1</tt> otherwise.
def setup
+ @orig_hooks = {}
@orig_env = ENV.to_hash
@tmp = File.expand_path("tmp")
FileUtils.mkdir_p @tmp
+ @tempdir = Dir.mktmpdir("test_rubygems_", @tmp)
+ @tempdir.tap(&Gem::UNTAINT)
+
ENV['GEM_VENDOR'] = nil
ENV['GEMRC'] = nil
ENV['XDG_CACHE_HOME'] = nil
@@ -324,9 +328,6 @@ class Gem::TestCase < Test::Unit::TestCase
# capture output
Gem::DefaultUserInteraction.ui = Gem::MockGemUi.new
- @tempdir = Dir.mktmpdir("test_rubygems_", @tmp)
- @tempdir.tap(&Gem::UNTAINT)
-
ENV["TMPDIR"] = @tempdir
@orig_SYSTEM_WIDE_CONFIG_FILE = Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE
@@ -426,7 +427,6 @@ class Gem::TestCase < Test::Unit::TestCase
util_set_arch 'i686-darwin8.10.1'
end
- @orig_hooks = {}
%w[post_install_hooks done_installing_hooks post_uninstall_hooks pre_uninstall_hooks pre_install_hooks pre_reset_hooks post_reset_hooks post_build_hooks].each do |name|
@orig_hooks[name] = Gem.send(name).dup
end