summaryrefslogtreecommitdiffstats
path: root/test/rubygems
diff options
context:
space:
mode:
Diffstat (limited to 'test/rubygems')
-rw-r--r--test/rubygems/gemutilities.rb15
-rw-r--r--test/rubygems/test_gem_installer.rb11
-rw-r--r--test/rubygems/test_gem_platform.rb2
3 files changed, 16 insertions, 12 deletions
diff --git a/test/rubygems/gemutilities.rb b/test/rubygems/gemutilities.rb
index 0d5ab0297..bb54ff636 100644
--- a/test/rubygems/gemutilities.rb
+++ b/test/rubygems/gemutilities.rb
@@ -8,7 +8,7 @@
at_exit { $SAFE = 1 }
require 'fileutils'
-require 'test/unit/testcase'
+require 'test/unit'
require 'tmpdir'
require 'uri'
require 'rubygems/gem_open_uri'
@@ -20,6 +20,10 @@ module Gem
def self.source_index=(si)
@@source_index = si
end
+
+ def self.win_platform=(val)
+ @@win_platform = val
+ end
end
class FakeFetcher
@@ -58,7 +62,8 @@ class RubyGemTestCase < Test::Unit::TestCase
include Gem::DefaultUserInteraction
- undef_method :default_test
+ undef_method :default_test if instance_methods.include? 'default_test' or
+ instance_methods.include? :default_test
def setup
super
@@ -84,7 +89,7 @@ class RubyGemTestCase < Test::Unit::TestCase
@gem_repo = "http://gems.example.com"
Gem.sources.replace [@gem_repo]
- @orig_arch = Config::CONFIG['arch']
+ @orig_arch = Gem::ConfigMap[:arch]
if win_platform?
util_set_arch 'i386-mswin32'
@@ -96,7 +101,7 @@ class RubyGemTestCase < Test::Unit::TestCase
end
def teardown
- Config::CONFIG['arch'] = @orig_arch
+ Gem::ConfigMap[:arch] = @orig_arch
if defined? Gem::RemoteFetcher then
Gem::RemoteFetcher.instance_variable_set :@fetcher, nil
@@ -228,7 +233,7 @@ class RubyGemTestCase < Test::Unit::TestCase
# Set the platform to +cpu+ and +os+
def util_set_arch(arch)
- Config::CONFIG['arch'] = arch
+ Gem::ConfigMap[:arch] = arch
platform = Gem::Platform.new arch
Gem.instance_variable_set :@platforms, nil
diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb
index 05e38f67f..9a091a291 100644
--- a/test/rubygems/test_gem_installer.rb
+++ b/test/rubygems/test_gem_installer.rb
@@ -417,8 +417,8 @@ load 'my_exec'
end
def test_generate_bin_symlinks_win32
- old_arch = Config::CONFIG["arch"]
- Config::CONFIG["arch"] = "win32"
+ old_win_platform = Gem.win_platform?
+ Gem.win_platform = true
@installer.wrappers = false
util_make_exec
@installer.gem_dir = util_gem_dir
@@ -431,16 +431,13 @@ load 'my_exec'
installed_exec = File.join(util_inst_bindir, "my_exec")
assert_equal true, File.exist?(installed_exec)
- assert_match(/Unable to use symlinks on win32, installing wrapper/i,
+ assert_match(/Unable to use symlinks on Windows, installing wrapper/i,
@ui.error)
-
- expected_mode = win_platform? ? 0100644 : 0100755
- assert_equal expected_mode, File.stat(installed_exec).mode
wrapper = File.read installed_exec
assert_match(/generated by RubyGems/, wrapper)
ensure
- Config::CONFIG["arch"] = old_arch
+ Gem.win_platform = old_win_platform
end
def test_generate_bin_uses_default_shebang
diff --git a/test/rubygems/test_gem_platform.rb b/test/rubygems/test_gem_platform.rb
index 4a1651bc0..a1462d4dc 100644
--- a/test/rubygems/test_gem_platform.rb
+++ b/test/rubygems/test_gem_platform.rb
@@ -19,6 +19,7 @@ class TestGemPlatform < RubyGemTestCase
end
def test_self_new
+ assert_equal Gem::Platform.local, Gem::Platform.new(Gem::Platform::CURRENT)
assert_equal Gem::Platform::RUBY, Gem::Platform.new(Gem::Platform::RUBY)
assert_equal Gem::Platform::RUBY, Gem::Platform.new(nil)
assert_equal Gem::Platform::RUBY, Gem::Platform.new('')
@@ -63,6 +64,7 @@ class TestGemPlatform < RubyGemTestCase
'i386-openbsd4.0' => ['x86', 'openbsd', '4.0'],
'i386-solaris2.10' => ['x86', 'solaris', '2.10'],
'i386-solaris2.8' => ['x86', 'solaris', '2.8'],
+ 'mswin32' => ['x86', 'mswin32', nil],
'x86_64-linux' => ['x86_64', 'linux', nil],
'x86_64-openbsd3.9' => ['x86_64', 'openbsd', '3.9'],
'x86_64-openbsd4.0' => ['x86_64', 'openbsd', '4.0'],