summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-30 00:54:12 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-30 00:54:12 +0000
commite00d5437d1453f0ec4fbc980a81c15630624eb71 (patch)
tree07c1340a8c4ea3d0b7ae2f209866af85de089f27 /test
parentf363bbdf1042562e40aaccbd1bdd7b783c096ff0 (diff)
downloadruby-e00d5437d1453f0ec4fbc980a81c15630624eb71.tar.gz
* lib/rubygems: Update to RubyGems HEAD(60d7972).
this version contains pull requests number of #1343, #1356, #1357, #1363 at https://github.com/rubygems/rubygems/pulls * test/rubygems: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/rubygems/test_gem_ext_builder.rb2
-rw-r--r--test/rubygems/test_gem_platform.rb11
-rw-r--r--test/rubygems/test_gem_remote_fetcher.rb12
-rw-r--r--test/rubygems/test_gem_specification.rb4
-rw-r--r--test/rubygems/test_require.rb30
5 files changed, 58 insertions, 1 deletions
diff --git a/test/rubygems/test_gem_ext_builder.rb b/test/rubygems/test_gem_ext_builder.rb
index 5607096a0b..02c7593628 100644
--- a/test/rubygems/test_gem_ext_builder.rb
+++ b/test/rubygems/test_gem_ext_builder.rb
@@ -147,6 +147,8 @@ install:
class << Gem
alias orig_install_extension_in_lib install_extension_in_lib
+ remove_method :install_extension_in_lib
+
def Gem.install_extension_in_lib
false
end
diff --git a/test/rubygems/test_gem_platform.rb b/test/rubygems/test_gem_platform.rb
index 17577dc744..164977224c 100644
--- a/test/rubygems/test_gem_platform.rb
+++ b/test/rubygems/test_gem_platform.rb
@@ -190,6 +190,17 @@ class TestGemPlatform < Gem::TestCase
assert((x86_darwin8 === Gem::Platform.local), 'universal =~ x86')
end
+ def test_nil_cpu_arch_is_treated_as_universal
+ with_nil_arch = Gem::Platform.new [nil, 'mingw32']
+ with_uni_arch = Gem::Platform.new ['universal', 'mingw32']
+ with_x86_arch = Gem::Platform.new ['x86', 'mingw32']
+
+ assert((with_nil_arch === with_uni_arch), 'nil =~ universal')
+ assert((with_uni_arch === with_nil_arch), 'universal =~ nil')
+ assert((with_nil_arch === with_x86_arch), 'nil =~ x86')
+ assert((with_x86_arch === with_nil_arch), 'x86 =~ nil')
+ end
+
def test_equals3_cpu_arm
arm = Gem::Platform.new 'arm-linux'
armv5 = Gem::Platform.new 'armv5-linux'
diff --git a/test/rubygems/test_gem_remote_fetcher.rb b/test/rubygems/test_gem_remote_fetcher.rb
index 93ae73afd4..5598e46b26 100644
--- a/test/rubygems/test_gem_remote_fetcher.rb
+++ b/test/rubygems/test_gem_remote_fetcher.rb
@@ -698,6 +698,14 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
assert_equal "too many redirects (#{url})", e.message
end
+ def test_fetch_http_with_additional_headers
+ ENV["http_proxy"] = @proxy_uri
+ ENV["no_proxy"] = URI::parse(@server_uri).host
+ fetcher = Gem::RemoteFetcher.new nil, nil, {"X-Captain" => "murphy"}
+ @fetcher = fetcher
+ assert_equal "murphy", fetcher.fetch_path(@server_uri)
+ end
+
def test_fetch_s3
fetcher = Gem::RemoteFetcher.new nil
@fetcher = fetcher
@@ -984,7 +992,9 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
)
s.mount_proc("/kill") { |req, res| s.shutdown }
s.mount_proc("/yaml") { |req, res|
- if @enable_yaml
+ if req["X-Captain"]
+ res.body = req["X-Captain"]
+ elsif @enable_yaml
res.body = data
res['Content-Type'] = 'text/plain'
res['content-length'] = data.size
diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb
index 0ada8db490..60f603361a 100644
--- a/test/rubygems/test_gem_specification.rb
+++ b/test/rubygems/test_gem_specification.rb
@@ -1724,6 +1724,8 @@ dependencies: []
class << Gem
alias orig_default_ext_dir_for default_ext_dir_for
+ remove_method :default_ext_dir_for
+
def Gem.default_ext_dir_for(base_dir)
'elsewhere'
end
@@ -2033,6 +2035,8 @@ dependencies: []
def test_require_paths_default_ext_dir_for
class << Gem
send :alias_method, :orig_default_ext_dir_for, :default_ext_dir_for
+
+ remove_method :default_ext_dir_for
end
def Gem.default_ext_dir_for base_dir
diff --git a/test/rubygems/test_require.rb b/test/rubygems/test_require.rb
index 96906595d7..08dd4cb9f9 100644
--- a/test/rubygems/test_require.rb
+++ b/test/rubygems/test_require.rb
@@ -80,6 +80,8 @@ class TestGemRequire < Gem::TestCase
end
def test_concurrent_require
+ skip 'deadlock' if /^1\.8\./ =~ RUBY_VERSION
+
Object.const_set :FILE_ENTERED_LATCH, Latch.new(2)
Object.const_set :FILE_EXIT_LATCH, Latch.new(1)
@@ -103,6 +105,8 @@ class TestGemRequire < Gem::TestCase
assert t1.join, "thread 1 should exit"
assert t2.join, "thread 2 should exit"
ensure
+ return if $! # skipping
+
Object.send :remove_const, :FILE_ENTERED_LATCH
Object.send :remove_const, :FILE_EXIT_LATCH
end
@@ -247,6 +251,32 @@ class TestGemRequire < Gem::TestCase
assert_equal "unable to find a version of 'b' to activate", e.message
end
+ def test_require_works_after_cleanup
+ a1 = new_default_spec "a", "1.0", nil, "a/b.rb"
+ b1 = new_default_spec "b", "1.0", nil, "b/c.rb"
+ b2 = new_default_spec "b", "2.0", nil, "b/d.rb"
+
+ install_default_gems a1
+ install_default_gems b1
+ install_default_gems b2
+
+ # Load default ruby gems fresh as if we've just started a ruby script.
+ Gem::Specification.reset
+ require 'rubygems'
+ Gem::Specification.stubs
+
+ # Remove an old default gem version directly from disk as if someone ran
+ # gem cleanup.
+ FileUtils.rm_rf(File.join @default_dir, "#{b1.full_name}")
+ FileUtils.rm_rf(File.join @default_spec_dir, "#{b1.full_name}.gemspec")
+
+ # Require gems that have not been removed.
+ assert_require 'a/b'
+ assert_equal %w(a-1.0), loaded_spec_names
+ assert_require 'b/d'
+ assert_equal %w(a-1.0 b-2.0), loaded_spec_names
+ end
+
def test_default_gem_only
default_gem_spec = new_default_spec("default", "2.0.0.0",
nil, "default/gem.rb")