diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-21 10:20:47 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-21 10:20:47 +0000 |
commit | 5335ce0e060c7a2a0b01c57f8f8a64254f2658e1 (patch) | |
tree | c63321cb7c7c5c15454a79d81123c7188be2c51e /test/rubygems/test_gem_installer.rb | |
parent | 2f023c5dbaadede9ceac3eb9ac0e73f3050e5ada (diff) | |
download | ruby-5335ce0e060c7a2a0b01c57f8f8a64254f2658e1.tar.gz |
Merge master branch from rubygems/rubygems upstream.
* Enable Style/MethodDefParentheses in Rubocop
https://github.com/rubygems/rubygems/pull/2478
* Enable Style/MultilineIfThen in Rubocop
https://github.com/rubygems/rubygems/pull/2479
* Fix required_ruby_version with prereleases and improve error message
https://github.com/rubygems/rubygems/pull/2344
* Fix bundler rubygems binstub not properly looking for bundler
https://github.com/rubygems/rubygems/pull/2426
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem_installer.rb')
-rw-r--r-- | test/rubygems/test_gem_installer.rb | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb index b8e4b1e2e5..4004df2a39 100644 --- a/test/rubygems/test_gem_installer.rb +++ b/test/rubygems/test_gem_installer.rb @@ -56,7 +56,7 @@ version = \">= 0.a\" if ARGV.first str = ARGV.first str = str.dup.force_encoding("BINARY") - if str =~ /\\A_(.*)_\\z/ and Gem::Version.correct?($1) then + if str =~ /\\A_(.*)_\\z/ and Gem::Version.correct?($1) version = $1 ARGV.shift end @@ -121,7 +121,7 @@ end ensure Object.const_set :RUBY_FRAMEWORK_VERSION, orig_RUBY_FRAMEWORK_VERSION if orig_RUBY_FRAMEWORK_VERSION - if orig_bindir then + if orig_bindir RbConfig::CONFIG['bindir'] = orig_bindir else RbConfig::CONFIG.delete 'bindir' @@ -250,7 +250,7 @@ gem 'other', version expected = @installer.bin_dir - if Gem.win_platform? then + if Gem.win_platform? expected = expected.downcase.gsub(File::SEPARATOR, File::ALT_SEPARATOR) end @@ -488,7 +488,7 @@ gem 'other', version real_exec = File.join @spec.gem_dir, 'bin', 'executable' # fake --no-wrappers for previous install - unless Gem.win_platform? then + unless Gem.win_platform? FileUtils.mkdir_p File.dirname(installed_exec) FileUtils.ln_s real_exec, installed_exec end @@ -692,7 +692,7 @@ gem 'other', version @installer.generate_bin - default_shebang = Gem.ruby.shellescape + default_shebang = Gem.ruby shebang_line = open("#{@gemhome}/bin/executable") { |f| f.readlines.first } assert_match(/\A#!/, shebang_line) assert_match(/#{default_shebang}/, shebang_line) @@ -965,7 +965,7 @@ gem 'other', version def test_install_force use_ui @ui do - installer = Gem::Installer.at old_ruby_required, :force => true + installer = Gem::Installer.at old_ruby_required('= 1.4.6'), :force => true installer.install end @@ -1380,16 +1380,32 @@ gem 'other', version def test_pre_install_checks_ruby_version use_ui @ui do - installer = Gem::Installer.at old_ruby_required + installer = Gem::Installer.at old_ruby_required('= 1.4.6') e = assert_raises Gem::RuntimeRequirementNotMetError do installer.pre_install_checks end - rv = Gem.ruby_api_version + rv = Gem.ruby_version assert_equal "old_ruby_required requires Ruby version = 1.4.6. The current ruby version is #{rv}.", e.message end end + def test_pre_install_checks_ruby_version_with_prereleases + util_set_RUBY_VERSION '2.6.0', -1, '63539', 'ruby 2.6.0preview2 (2018-05-31 trunk 63539) [x86_64-linux]' + + installer = Gem::Installer.at old_ruby_required('>= 2.6.0.preview2') + assert installer.pre_install_checks + + installer = Gem::Installer.at old_ruby_required('> 2.6.0.preview2') + e = assert_raises Gem::RuntimeRequirementNotMetError do + assert installer.pre_install_checks + end + assert_equal "old_ruby_required requires Ruby version > 2.6.0.preview2. The current ruby version is 2.6.0.preview2.", + e.message + ensure + util_restore_RUBY_VERSION + end + def test_pre_install_checks_wrong_rubygems_version spec = util_spec 'old_rubygems_required', '1' do |s| s.required_rubygems_version = '< 0' @@ -1415,7 +1431,7 @@ gem 'other', version def spec.full_name # so the spec is buildable "malicious-1" end - def spec.validate packaging, strict; end + def spec.validate(packaging, strict); end util_build_gem spec @@ -1720,9 +1736,9 @@ gem 'other', version assert_equal ['bin/executable'], default_spec.files end - def old_ruby_required + def old_ruby_required(requirement) spec = util_spec 'old_ruby_required', '1' do |s| - s.required_ruby_version = '= 1.4.6' + s.required_ruby_version = requirement end util_build_gem spec @@ -1737,7 +1753,7 @@ gem 'other', version @installer = util_installer @spec, @gemhome end - def util_conflict_executable wrappers + def util_conflict_executable(wrappers) conflict = quick_gem 'conflict' do |spec| util_make_exec spec end |