aboutsummaryrefslogtreecommitdiffstats
path: root/test/rubygems/test_gem_installer.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-28 02:26:39 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-28 02:26:39 +0000
commit7fbb9078fe61104606a40e4e450a2cd1a33f8ca1 (patch)
treebd57731d31e70e0b5837bcff618f0b56b2be3b5e /test/rubygems/test_gem_installer.rb
parent6cc4937aec6596bff58fc946b4b00c7b546e494a (diff)
downloadruby-7fbb9078fe61104606a40e4e450a2cd1a33f8ca1.tar.gz
* lib/rubygems.rb, lib/rubygems/*, test/rubygems/*: Update rubygems-2.6.2.
Please see entries of 2.6.2 on https://github.com/rubygems/rubygems/blob/master/History.txt git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem_installer.rb')
-rw-r--r--test/rubygems/test_gem_installer.rb51
1 files changed, 50 insertions, 1 deletions
diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb
index 5ec71d0a01..f9149650f0 100644
--- a/test/rubygems/test_gem_installer.rb
+++ b/test/rubygems/test_gem_installer.rb
@@ -48,7 +48,7 @@ if ARGV.first
end
end
-load Gem.bin_path('a', 'executable', version)
+load Gem.activate_bin_path('a', 'executable', version)
EOF
wrapper = @installer.app_script_text 'executable'
@@ -781,6 +781,55 @@ gem 'other', version
assert_match(/ran executable/, e.message)
end
+ def test_conflicting_binstubs
+ Dir.mkdir util_inst_bindir
+ util_clear_gems
+
+ # build old version that has a bin file
+ util_setup_gem do |spec|
+ File.open File.join('bin', 'executable'), 'w' do |f|
+ f.puts "require 'code'"
+ end
+ File.open File.join('lib', 'code.rb'), 'w' do |f|
+ f.puts 'raise "I have an executable"'
+ end
+ end
+
+ @installer.wrappers = true
+ build_rake_in do
+ use_ui @ui do
+ @newspec = @installer.install
+ end
+ end
+
+ old_bin_file = File.join @installer.bin_dir, 'executable'
+
+ # build new version that doesn't have a bin file
+ util_setup_gem do |spec|
+ FileUtils.rm File.join('bin', 'executable')
+ spec.files.delete File.join('bin', 'executable')
+ spec.executables.delete 'executable'
+ spec.version = @spec.version.bump
+ File.open File.join('lib', 'code.rb'), 'w' do |f|
+ f.puts 'raise "I do not have an executable"'
+ end
+ end
+
+ build_rake_in do
+ use_ui @ui do
+ @newspec = @installer.install
+ end
+ end
+
+ e = assert_raises RuntimeError do
+ instance_eval File.read(old_bin_file)
+ end
+
+ # We expect the bin stub to activate the version that actually contains
+ # the binstub.
+ assert_match('I have an executable', e.message)
+ end
+
def test_install_creates_binstub_that_understand_version
Dir.mkdir util_inst_bindir
util_setup_gem