diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-04-02 11:48:18 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-04-02 11:48:18 +0000 |
commit | f28be7e02d113bd26c33cb94e65004055576c065 (patch) | |
tree | 48b87f5a2b647e1207bae5e29f40d6d5b526978d /test/rubygems/test_gem.rb | |
parent | 537024433720d7c54cba9bab4596638f59fbadc9 (diff) |
Merge rubygems/rubygems from upstream.
The current master branch is
https://github.com/rubygems/rubygems/commit/97b264f0fa248c864b6ee9a23d3ff1cdd217dddb
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem.rb')
-rw-r--r-- | test/rubygems/test_gem.rb | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb index ad802e0f95..abf7092991 100644 --- a/test/rubygems/test_gem.rb +++ b/test/rubygems/test_gem.rb @@ -954,37 +954,23 @@ class TestGem < Gem::TestCase end def test_self_ruby_escaping_spaces_in_path - orig_bindir = RbConfig::CONFIG['bindir'] - orig_exe_ext = RbConfig::CONFIG['EXEEXT'] - - RbConfig::CONFIG['bindir'] = "C:/Ruby 1.8/bin" - RbConfig::CONFIG['EXEEXT'] = ".exe" - - ruby_install_name "ruby" do - with_clean_path_to_ruby do - assert_equal "\"C:/Ruby 1.8/bin/ruby.exe\"", Gem.ruby + with_clean_path_to_ruby do + with_bindir_and_exeext("C:/Ruby 1.8/bin", ".exe") do + ruby_install_name "ruby" do + assert_equal "\"C:/Ruby 1.8/bin/ruby.exe\"", Gem.ruby + end end end - ensure - RbConfig::CONFIG['bindir'] = orig_bindir - RbConfig::CONFIG['EXEEXT'] = orig_exe_ext end def test_self_ruby_path_without_spaces - orig_bindir = RbConfig::CONFIG['bindir'] - orig_exe_ext = RbConfig::CONFIG['EXEEXT'] - - RbConfig::CONFIG['bindir'] = "C:/Ruby18/bin" - RbConfig::CONFIG['EXEEXT'] = ".exe" - - ruby_install_name "ruby" do - with_clean_path_to_ruby do - assert_equal "C:/Ruby18/bin/ruby.exe", Gem.ruby + with_clean_path_to_ruby do + with_bindir_and_exeext("C:/Ruby18/bin", ".exe") do + ruby_install_name "ruby" do + assert_equal "C:/Ruby18/bin/ruby.exe", Gem.ruby + end end end - ensure - RbConfig::CONFIG['bindir'] = orig_bindir - RbConfig::CONFIG['EXEEXT'] = orig_exe_ext end def test_self_ruby_api_version @@ -1902,6 +1888,19 @@ You may need to `gem install -g` to install missing gems end end + def with_bindir_and_exeext(bindir, exeext) + orig_bindir = RbConfig::CONFIG['bindir'] + orig_exe_ext = RbConfig::CONFIG['EXEEXT'] + + RbConfig::CONFIG['bindir'] = bindir + RbConfig::CONFIG['EXEEXT'] = exeext + + yield + ensure + RbConfig::CONFIG['bindir'] = orig_bindir + RbConfig::CONFIG['EXEEXT'] = orig_exe_ext + end + def with_clean_path_to_ruby orig_ruby = Gem.ruby @@ -1909,7 +1908,7 @@ You may need to `gem install -g` to install missing gems yield ensure - Gem.instance_variable_set("@ruby", orig_ruby) + Gem.instance_variable_set :@ruby, orig_ruby end def with_plugin(path) |