diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-05-30 13:01:35 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-05-30 13:01:35 +0000 |
commit | 8da8d4b043c37b53a69803c71ff36b478d4776d0 (patch) | |
tree | 7c8cec15645e74f19c88e4eb5b210b96174c7d03 /test/rubygems/test_gem_commands_setup_command.rb | |
parent | c5cb386eba6d9a2d9a8e6ffa8c30137d0c4660c1 (diff) | |
download | ruby-8da8d4b043c37b53a69803c71ff36b478d4776d0.tar.gz |
Merge RubyGems 3.0.0.beta1.
* It drop to support < Ruby 2.2
* Cleanup deprecated methods and classes.
* Mark obsoleted methods to deprecate.
* and other enhancements.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem_commands_setup_command.rb')
-rw-r--r-- | test/rubygems/test_gem_commands_setup_command.rb | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/test/rubygems/test_gem_commands_setup_command.rb b/test/rubygems/test_gem_commands_setup_command.rb index c4de8c53d5..6d388ab0ee 100644 --- a/test/rubygems/test_gem_commands_setup_command.rb +++ b/test/rubygems/test_gem_commands_setup_command.rb @@ -103,6 +103,32 @@ class TestGemCommandsSetupCommand < Gem::TestCase assert_equal "I changed it!\n", File.read(gem_bin_path) end + def test_env_shebang_flag + gem_bin_path = gem_install 'a' + write_file gem_bin_path do |io| + io.puts 'I changed it!' + end + + @cmd.options[:document] = [] + @cmd.options[:env_shebang] = true + @cmd.execute + + default_gem_bin_path = File.join @install_dir, 'bin', 'gem' + default_bundle_bin_path = File.join @install_dir, 'bin', 'bundle' + + ruby_exec = sprintf Gem.default_exec_format, 'ruby' + + if Gem.win_platform? + assert_match %r%\A#!\s*#{ruby_exec}%, File.read(default_gem_bin_path) + assert_match %r%\A#!\s*#{ruby_exec}%, File.read(default_bundle_bin_path) + assert_match %r%\A#!\s*#{ruby_exec}%, File.read(gem_bin_path) + else + assert_match %r%\A#!/usr/bin/env #{ruby_exec}%, File.read(default_gem_bin_path) + assert_match %r%\A#!/usr/bin/env #{ruby_exec}%, File.read(default_bundle_bin_path) + assert_match %r%\A#!/usr/bin/env #{ruby_exec}%, File.read(gem_bin_path) + end + end + def test_pem_files_in assert_equal %w[rubygems/ssl_certs/rubygems.org/foo.pem], @cmd.pem_files_in('lib').sort @@ -207,11 +233,8 @@ class TestGemCommandsSetupCommand < Gem::TestCase end def test_show_release_notes - @default_external = nil - if Object.const_defined? :Encoding - @default_external = @ui.outs.external_encoding - @ui.outs.set_encoding Encoding::US_ASCII - end + @default_external = @ui.outs.external_encoding + @ui.outs.set_encoding Encoding::US_ASCII @cmd.options[:previous_version] = Gem::Version.new '2.0.2' @@ -256,7 +279,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase EXPECTED output = @ui.output - output.force_encoding Encoding::UTF_8 if Object.const_defined? :Encoding + output.force_encoding Encoding::UTF_8 assert_equal expected, output ensure |