aboutsummaryrefslogtreecommitdiffstats
path: root/test/rubygems/test_gem_installer.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/rubygems/test_gem_installer.rb')
-rw-r--r--test/rubygems/test_gem_installer.rb37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb
index bb48f35d9f..ddedd8144c 100644
--- a/test/rubygems/test_gem_installer.rb
+++ b/test/rubygems/test_gem_installer.rb
@@ -190,6 +190,43 @@ load Gem.bin_path('a', 'executable', version)
Gem::ConfigMap[:bindir] = orig_bindir
end
+ def test_check_executable_overwrite_format_executable
+ @installer.generate_bin
+
+ @spec = Gem::Specification.new do |s|
+ s.files = ['lib/code.rb']
+ s.name = "a"
+ s.version = "3"
+ s.summary = "summary"
+ s.description = "desc"
+ s.require_path = 'lib'
+ end
+
+ open File.join(util_inst_bindir, 'executable'), 'w' do |io|
+ io.write <<-EXEC
+#!/usr/local/bin/ruby
+#
+# This file was generated by RubyGems
+
+gem 'other', version
+ EXEC
+ end
+
+ util_make_exec
+ Gem::Installer.exec_format = 'foo-%s-bar'
+ @installer.gem_dir = @spec.gem_dir
+ @installer.wrappers = true
+ @installer.format_executable = true
+
+ @installer.generate_bin # should not raise
+
+ installed_exec = File.join util_inst_bindir, 'foo-executable-bar'
+ assert File.exist? installed_exec
+
+ wrapper = File.read installed_exec
+ assert_match %r|generated by RubyGems|, wrapper
+ end
+
def test_check_executable_overwrite_other_gem
util_conflict_executable true