diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-03-04 00:29:40 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-03-04 00:29:40 +0000 |
commit | 5a90f9e8f84533e7859232895fc4bbe6b31cc771 (patch) | |
tree | e15086587f691a1f5bd3c7ddbfa38e825828caf6 /test/rubygems/test_gem_path_support.rb | |
parent | f1321bd6e7c2d6b6a29a67074bad6f2742263921 (diff) | |
download | ruby-5a90f9e8f84533e7859232895fc4bbe6b31cc771.tar.gz |
* lib/rubygems.rb, lib/rubygems/*, test/rubygems/*: Update rubygems-2.6.1.
Please see entries of 2.6.0 and 2.6.1 on
https://github.com/rubygems/rubygems/blob/master/History.txt
[fix GH-1270] Patch by @segiddins
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem_path_support.rb')
-rw-r--r-- | test/rubygems/test_gem_path_support.rb | 48 |
1 files changed, 42 insertions, 6 deletions
diff --git a/test/rubygems/test_gem_path_support.rb b/test/rubygems/test_gem_path_support.rb index a4be66fe61..754c43e893 100644 --- a/test/rubygems/test_gem_path_support.rb +++ b/test/rubygems/test_gem_path_support.rb @@ -12,7 +12,7 @@ class TestGemPathSupport < Gem::TestCase end def test_initialize - ps = Gem::PathSupport.new + ps = Gem::PathSupport.new ENV assert_equal ENV["GEM_HOME"], ps.home @@ -21,7 +21,7 @@ class TestGemPathSupport < Gem::TestCase end def test_initialize_home - ps = Gem::PathSupport.new "GEM_HOME" => "#{@tempdir}/foo" + ps = Gem::PathSupport.new ENV.to_hash.merge("GEM_HOME" => "#{@tempdir}/foo") assert_equal File.join(@tempdir, "foo"), ps.home @@ -39,7 +39,7 @@ class TestGemPathSupport < Gem::TestCase end def test_initialize_path - ps = Gem::PathSupport.new "GEM_PATH" => %W[#{@tempdir}/foo #{@tempdir}/bar] + ps = Gem::PathSupport.new ENV.to_hash.merge("GEM_PATH" => %W[#{@tempdir}/foo #{@tempdir}/bar].join(Gem.path_separator)) assert_equal ENV["GEM_HOME"], ps.home @@ -52,9 +52,45 @@ class TestGemPathSupport < Gem::TestCase assert_equal expected, ps.path end + def test_initialize_regexp_path_separator + Gem.stub(:path_separator, /#{File::PATH_SEPARATOR}/) do + path = %W[#{@tempdir}/foo + #{File::PATH_SEPARATOR} + #{@tempdir}/bar + #{File::PATH_SEPARATOR}].join + ps = Gem::PathSupport.new "GEM_PATH" => path, "GEM_HOME" => ENV["GEM_HOME"] + + assert_equal ENV["GEM_HOME"], ps.home + + expected = [ + File.join(@tempdir, 'foo'), + File.join(@tempdir, 'bar'), + ] + Gem.default_path << ENV["GEM_HOME"] + + assert_equal expected, ps.path + end + end + + def test_initialize_path_with_defaults + path = %W[#{@tempdir}/foo + #{File::PATH_SEPARATOR} + #{@tempdir}/bar + #{File::PATH_SEPARATOR}].join + ps = Gem::PathSupport.new "GEM_PATH" => path, "GEM_HOME" => ENV["GEM_HOME"] + + assert_equal ENV["GEM_HOME"], ps.home + + expected = [ + File.join(@tempdir, 'foo'), + File.join(@tempdir, 'bar'), + ] + Gem.default_path << ENV["GEM_HOME"] + + assert_equal expected, ps.path + end + def test_initialize_home_path ps = Gem::PathSupport.new("GEM_HOME" => "#{@tempdir}/foo", - "GEM_PATH" => %W[#{@tempdir}/foo #{@tempdir}/bar]) + "GEM_PATH" => %W[#{@tempdir}/foo #{@tempdir}/bar].join(Gem.path_separator)) assert_equal File.join(@tempdir, "foo"), ps.home @@ -69,12 +105,12 @@ class TestGemPathSupport < Gem::TestCase def test_initialize_spec ENV["GEM_SPEC_CACHE"] = nil - ps = Gem::PathSupport.new + ps = Gem::PathSupport.new ENV assert_equal Gem.default_spec_cache_dir, ps.spec_cache_dir ENV["GEM_SPEC_CACHE"] = 'bar' - ps = Gem::PathSupport.new + ps = Gem::PathSupport.new ENV assert_equal ENV["GEM_SPEC_CACHE"], ps.spec_cache_dir ENV["GEM_SPEC_CACHE"] = File.join @tempdir, 'spec_cache' |