diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-03-12 21:44:56 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-03-12 21:44:56 +0000 |
commit | 7244db9da3a02fc5577200ad67a2e132b4a41f26 (patch) | |
tree | 950603fd0ce72f0b0c09377d98c137cbbc3d473e /test/rubygems/test_gem.rb | |
parent | 213582c85e18d428c192d620bb930ed0acfcd675 (diff) |
Merge RubyGems 2.7.6.2 patch [Bug #15643]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@67235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem.rb')
-rw-r--r-- | test/rubygems/test_gem.rb | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb index 693e5e0969..419497c75f 100644 --- a/test/rubygems/test_gem.rb +++ b/test/rubygems/test_gem.rb @@ -209,6 +209,41 @@ class TestGem < Gem::TestCase assert_equal %w(a-1 b-2 c-1), loaded_spec_names end + def test_activate_bin_path_gives_proper_error_for_bundler + bundler = util_spec 'bundler', '2' do |s| + s.executables = ['bundle'] + end + + install_specs bundler + + File.open("Gemfile.lock", "w") do |f| + f.write <<-L.gsub(/ {8}/, "") + GEM + remote: https://rubygems.org/ + specs: + + PLATFORMS + ruby + + DEPENDENCIES + + BUNDLED WITH + 9999 + L + end + + File.open("Gemfile", "w") { |f| f.puts('source "https://rubygems.org"') } + + e = assert_raises Gem::GemNotFoundException do + load Gem.activate_bin_path("bundler", "bundle", ">= 0.a") + end + + assert_includes e.message, "Could not find 'bundler' (9999) required by your #{File.expand_path("Gemfile.lock")}." + assert_includes e.message, "To update to the latest version installed on your system, run `bundle update --bundler`." + assert_includes e.message, "To install the missing version, run `gem install bundler:9999`" + refute_includes e.message, "can't find gem bundler (>= 0.a) with executable bundle" + end + def test_self_bin_path_no_exec_name e = assert_raises ArgumentError do Gem.bin_path 'a' |