diff options
Diffstat (limited to 'lib/rubygems/test_case.rb')
-rw-r--r-- | lib/rubygems/test_case.rb | 39 |
1 files changed, 13 insertions, 26 deletions
diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb index 09b91b6ac6..a8261ef5c2 100644 --- a/lib/rubygems/test_case.rb +++ b/lib/rubygems/test_case.rb @@ -252,14 +252,14 @@ class Gem::TestCase < Minitest::Test msg = message(msg) do 'Expected output containing make command "%s": %s' % [ ('%s %s' % [make_command, target]).rstrip, - output.inspect + output.inspect, ] end else msg = message(msg) do 'Expected make command "%s": %s' % [ ('%s %s' % [make_command, target]).rstrip, - output.inspect + output.inspect, ] end end @@ -335,6 +335,7 @@ class Gem::TestCase < Minitest::Test @git = ENV['GIT'] || (win_platform? ? 'git.exe' : 'git') Gem.ensure_gem_subdirectories @gemhome + Gem.ensure_default_gem_subdirectories @gemhome @orig_LOAD_PATH = $LOAD_PATH.dup $LOAD_PATH.map! do |s| @@ -360,26 +361,23 @@ class Gem::TestCase < Minitest::Test Gem.send :remove_instance_variable, :@ruby_version if Gem.instance_variables.include? :@ruby_version - FileUtils.mkdir_p @gemhome FileUtils.mkdir_p @userhome ENV['GEM_PRIVATE_KEY_PASSPHRASE'] = PRIVATE_KEY_PASSPHRASE - @default_dir = File.join @tempdir, 'default' - @default_spec_dir = File.join @default_dir, "specifications", "default" if Gem.java_platform? @orig_default_gem_home = RbConfig::CONFIG['default_gem_home'] - RbConfig::CONFIG['default_gem_home'] = @default_dir + RbConfig::CONFIG['default_gem_home'] = @gemhome else - Gem.instance_variable_set(:@default_dir, @default_dir) + Gem.instance_variable_set(:@default_dir, @gemhome) end - FileUtils.mkdir_p @default_spec_dir + + @orig_bindir = RbConfig::CONFIG["bindir"] + RbConfig::CONFIG["bindir"] = File.join @gemhome, "bin" Gem::Specification.unresolved_deps.clear Gem.use_paths(@gemhome) - Gem::Security.reset - Gem.loaded_specs.clear Gem.instance_variable_set(:@activated_gem_paths, 0) Gem.clear_default_specs @@ -448,6 +446,8 @@ class Gem::TestCase < Minitest::Test Gem.ruby = @orig_ruby if @orig_ruby + RbConfig::CONFIG['bindir'] = @orig_bindir + if Gem.java_platform? RbConfig::CONFIG['default_gem_home'] = @orig_default_gem_home else @@ -741,7 +741,7 @@ class Gem::TestCase < Minitest::Test def install_specs(*specs) specs.each do |spec| - Gem::Installer.for_spec(spec).install + Gem::Installer.for_spec(spec, :force => true).install end Gem.searcher = nil @@ -751,19 +751,6 @@ class Gem::TestCase < Minitest::Test # Installs the provided default specs including writing the spec file def install_default_gems(*specs) - install_default_specs(*specs) - - specs.each do |spec| - File.open spec.loaded_from, 'w' do |io| - io.write spec.to_ruby_for_cache - end - end - end - - ## - # Install the provided default specs - - def install_default_specs(*specs) specs.each do |spec| installer = Gem::Installer.for_spec(spec, :install_as_default => true) installer.install @@ -792,7 +779,7 @@ class Gem::TestCase < Minitest::Test def new_default_spec(name, version, deps = nil, *files) spec = util_spec name, version, deps - spec.loaded_from = File.join(@default_spec_dir, spec.spec_name) + spec.loaded_from = File.join(@gemhome, "specifications", "default", spec.spec_name) spec.files = files lib_dir = File.join(@tempdir, "default_gems", "lib") @@ -1517,7 +1504,7 @@ Also, a list: PRIVATE_KEY = nil PUBLIC_KEY = nil PUBLIC_CERT = nil - end if defined?(OpenSSL::SSL) + end if Gem::HAVE_OPENSSL end require 'rubygems/test_utilities' |