summaryrefslogtreecommitdiff
path: root/test/rubygems
diff options
context:
space:
mode:
Diffstat (limited to 'test/rubygems')
-rw-r--r--test/rubygems/plugin/load/rubygems_plugin.rb2
-rw-r--r--test/rubygems/test_deprecate.rb3
-rw-r--r--test/rubygems/test_gem.rb81
-rw-r--r--test/rubygems/test_gem_available_set.rb5
-rw-r--r--test/rubygems/test_gem_bundler_version_finder.rb6
-rw-r--r--test/rubygems/test_gem_command.rb97
-rw-r--r--test/rubygems/test_gem_commands_cleanup_command.rb28
-rw-r--r--test/rubygems/test_gem_commands_environment_command.rb1
-rw-r--r--test/rubygems/test_gem_commands_help_command.rb2
-rw-r--r--test/rubygems/test_gem_commands_info_command.rb1
-rw-r--r--test/rubygems/test_gem_commands_install_command.rb55
-rw-r--r--test/rubygems/test_gem_commands_mirror.rb1
-rw-r--r--test/rubygems/test_gem_commands_outdated_command.rb1
-rw-r--r--test/rubygems/test_gem_commands_pristine_command.rb17
-rw-r--r--test/rubygems/test_gem_commands_push_command.rb18
-rw-r--r--test/rubygems/test_gem_commands_query_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_setup_command.rb60
-rw-r--r--test/rubygems/test_gem_commands_signin_command.rb7
-rw-r--r--test/rubygems/test_gem_commands_sources_command.rb8
-rw-r--r--test/rubygems/test_gem_commands_uninstall_command.rb10
-rw-r--r--test/rubygems/test_gem_commands_update_command.rb37
-rw-r--r--test/rubygems/test_gem_commands_yank_command.rb3
-rw-r--r--test/rubygems/test_gem_config_file.rb1
-rw-r--r--test/rubygems/test_gem_dependency_installer.rb20
-rw-r--r--test/rubygems/test_gem_dependency_list.rb27
-rw-r--r--test/rubygems/test_gem_ext_builder.rb4
-rw-r--r--test/rubygems/test_gem_ext_rake_builder.rb2
-rw-r--r--test/rubygems/test_gem_gemcutter_utilities.rb16
-rw-r--r--test/rubygems/test_gem_indexer.rb7
-rw-r--r--test/rubygems/test_gem_install_update_options.rb1
-rw-r--r--test/rubygems/test_gem_installer.rb18
-rw-r--r--test/rubygems/test_gem_package.rb49
-rw-r--r--test/rubygems/test_gem_package_tar_reader_entry.rb10
-rw-r--r--test/rubygems/test_gem_package_tar_writer.rb16
-rw-r--r--test/rubygems/test_gem_path_support.rb2
-rw-r--r--test/rubygems/test_gem_platform.rb5
-rw-r--r--test/rubygems/test_gem_rdoc.rb137
-rw-r--r--test/rubygems/test_gem_remote_fetcher.rb31
-rw-r--r--test/rubygems/test_gem_request.rb10
-rw-r--r--test/rubygems/test_gem_request_connection_pools.rb8
-rw-r--r--test/rubygems/test_gem_request_set.rb41
-rw-r--r--test/rubygems/test_gem_request_set_gem_dependency_api.rb36
-rw-r--r--test/rubygems/test_gem_request_set_lockfile.rb1
-rw-r--r--test/rubygems/test_gem_request_set_lockfile_parser.rb2
-rw-r--r--test/rubygems/test_gem_request_set_lockfile_tokenizer.rb2
-rw-r--r--test/rubygems/test_gem_requirement.rb1
-rw-r--r--test/rubygems/test_gem_resolver.rb79
-rw-r--r--test/rubygems/test_gem_resolver_index_specification.rb9
-rw-r--r--test/rubygems/test_gem_resolver_installer_set.rb4
-rw-r--r--test/rubygems/test_gem_resolver_specification.rb2
-rw-r--r--test/rubygems/test_gem_security.rb2
-rw-r--r--test/rubygems/test_gem_server.rb8
-rw-r--r--test/rubygems/test_gem_silent_ui.rb1
-rw-r--r--test/rubygems/test_gem_source.rb14
-rw-r--r--test/rubygems/test_gem_source_fetch_problem.rb1
-rw-r--r--test/rubygems/test_gem_source_git.rb8
-rw-r--r--test/rubygems/test_gem_source_installed.rb12
-rw-r--r--test/rubygems/test_gem_source_list.rb1
-rw-r--r--test/rubygems/test_gem_source_local.rb9
-rw-r--r--test/rubygems/test_gem_source_lock.rb24
-rw-r--r--test/rubygems/test_gem_source_specific_file.rb13
-rw-r--r--test/rubygems/test_gem_source_vendor.rb8
-rw-r--r--test/rubygems/test_gem_specification.rb37
-rw-r--r--test/rubygems/test_gem_stream_ui.rb2
-rw-r--r--test/rubygems/test_gem_stub_specification.rb1
-rw-r--r--test/rubygems/test_gem_text.rb2
-rw-r--r--test/rubygems/test_gem_uninstaller.rb31
-rw-r--r--test/rubygems/test_gem_util.rb4
-rw-r--r--test/rubygems/test_gem_version.rb17
-rw-r--r--test/rubygems/test_kernel.rb1
-rw-r--r--test/rubygems/test_remote_fetch_error.rb1
-rw-r--r--test/rubygems/test_require.rb8
72 files changed, 799 insertions, 394 deletions
diff --git a/test/rubygems/plugin/load/rubygems_plugin.rb b/test/rubygems/plugin/load/rubygems_plugin.rb
index 7cc6bef90b..85a6851ace 100644
--- a/test/rubygems/plugin/load/rubygems_plugin.rb
+++ b/test/rubygems/plugin/load/rubygems_plugin.rb
@@ -1,4 +1,6 @@
# frozen_string_literal: true
class TestGem
+
TEST_PLUGIN_LOAD = :loaded
+
end
diff --git a/test/rubygems/test_deprecate.rb b/test/rubygems/test_deprecate.rb
index fab4f33b86..b92bd1c3da 100644
--- a/test/rubygems/test_deprecate.rb
+++ b/test/rubygems/test_deprecate.rb
@@ -45,6 +45,7 @@ class TestDeprecate < Gem::TestCase
end
class Thing
+
extend Gem::Deprecate
attr_accessor :message
def foo
@@ -54,6 +55,7 @@ class TestDeprecate < Gem::TestCase
@message = "bar"
end
deprecate :foo, :bar, 2099, 3
+
end
def test_deprecated_method_calls_the_old_method
@@ -74,4 +76,5 @@ class TestDeprecate < Gem::TestCase
assert_match(/Thing#foo is deprecated; use bar instead\./, err)
assert_match(/on or after 2099-03-01/, err)
end
+
end
diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
index c913f30e27..b2f718bf1a 100644
--- a/test/rubygems/test_gem.rb
+++ b/test/rubygems/test_gem.rb
@@ -14,7 +14,6 @@ $LOAD_PATH.map! do |path|
end
class TestGem < Gem::TestCase
- RUBY_INSTALL_NAME = RbConfig::CONFIG['RUBY_INSTALL_NAME']
PLUGINS_LOADED = [] # rubocop:disable Style/MutableConstant
@@ -151,35 +150,40 @@ class TestGem < Gem::TestCase
end
def test_self_install_permissions_with_format_executable
- @format_executable = true
- assert_self_install_permissions
+ assert_self_install_permissions(format_executable: true)
+ end
+
+ def test_self_install_permissions_with_format_executable_and_non_standard_ruby_install_name
+ Gem::Installer.exec_format = nil
+ ruby_install_name 'ruby27' do
+ assert_self_install_permissions(format_executable: true)
+ end
+ ensure
+ Gem::Installer.exec_format = nil
end
- def assert_self_install_permissions
+ def assert_self_install_permissions(format_executable: false)
mask = win_platform? ? 0700 : 0777
options = {
:dir_mode => 0500,
- :prog_mode => 0510,
+ :prog_mode => win_platform? ? 0410 : 0510,
:data_mode => 0640,
:wrappers => true,
- :format_executable => !!(@format_executable if defined?(@format_executable))
+ :format_executable => format_executable
}
Dir.chdir @tempdir do
Dir.mkdir 'bin'
- File.open 'bin/foo.cmd', 'w' do |fp|
- fp.chmod(0755)
- fp.puts 'p'
- end
-
Dir.mkdir 'data'
- File.open 'data/foo.txt', 'w' do |fp|
- fp.puts 'blah'
- end
+
+ File.write 'bin/foo', "#!/usr/bin/env ruby\n"
+ File.chmod 0755, 'bin/foo'
+
+ File.write 'data/foo.txt', "blah\n"
spec_fetcher do |f|
f.gem 'foo', 1 do |s|
- s.executables = ['foo.cmd']
- s.files = %w[bin/foo.cmd data/foo.txt]
+ s.executables = ['foo']
+ s.files = %w[bin/foo data/foo.txt]
end
end
Gem.install 'foo', Gem::Requirement.default, options
@@ -188,19 +192,18 @@ class TestGem < Gem::TestCase
prog_mode = (options[:prog_mode] & mask).to_s(8)
dir_mode = (options[:dir_mode] & mask).to_s(8)
data_mode = (options[:data_mode] & mask).to_s(8)
- prog_name = 'foo.cmd'
- prog_name = RUBY_INSTALL_NAME.sub('ruby', 'foo.cmd') if options[:format_executable]
+ prog_name = 'foo'
+ prog_name = RbConfig::CONFIG['ruby_install_name'].sub('ruby', 'foo') if options[:format_executable]
expected = {
"bin/#{prog_name}" => prog_mode,
'gems/foo-1' => dir_mode,
'gems/foo-1/bin' => dir_mode,
'gems/foo-1/data' => dir_mode,
- 'gems/foo-1/bin/foo.cmd' => prog_mode,
+ 'gems/foo-1/bin/foo' => prog_mode,
'gems/foo-1/data/foo.txt' => data_mode,
}
- # below is for intermittent errors on Appveyor & Travis 2019-01,
- # see https://github.com/rubygems/rubygems/pull/2568
- sleep 0.2
+ # add Windows script
+ expected["bin/#{prog_name}.bat"] = mask.to_s(8) if win_platform?
result = {}
Dir.chdir @gemhome do
expected.each_key do |n|
@@ -209,7 +212,7 @@ class TestGem < Gem::TestCase
end
assert_equal(expected, result)
ensure
- File.chmod(0755, *Dir.glob(@gemhome+'/gems/**/').map {|path| path.untaint})
+ File.chmod(0755, *Dir.glob(@gemhome + '/gems/**/').map {|path| path.untaint})
end
def test_require_missing
@@ -413,7 +416,10 @@ class TestGem < Gem::TestCase
fp.puts 'blah'
end
- foo = util_spec 'foo' do |s| s.files = %w[data/foo.txt] end
+ foo = util_spec 'foo' do |s|
+ s.files = %w[data/foo.txt]
+ end
+
install_gem foo
end
@@ -631,7 +637,7 @@ class TestGem < Gem::TestCase
discover_path = File.join 'lib', 'sff', 'discover.rb'
- foo1, foo2 = %w(1 2).map { |version|
+ foo1, foo2 = %w(1 2).map do |version|
spec = quick_gem 'sff', version do |s|
s.files << discover_path
end
@@ -641,7 +647,7 @@ class TestGem < Gem::TestCase
end
spec
- }
+ end
Gem.refresh
@@ -663,7 +669,7 @@ class TestGem < Gem::TestCase
discover_path = File.join 'lib', 'sff', 'discover.rb'
- foo1, _ = %w(1 2).map { |version|
+ foo1, _ = %w(1 2).map do |version|
spec = quick_gem 'sff', version do |s|
s.files << discover_path
end
@@ -673,7 +679,7 @@ class TestGem < Gem::TestCase
end
spec
- }
+ end
Gem.refresh
write_file(File.join Dir.pwd, 'Gemfile') do |fp|
@@ -699,7 +705,7 @@ class TestGem < Gem::TestCase
discover_path = File.join 'lib', 'sff', 'discover.rb'
- _, foo2 = %w(1 2).map { |version|
+ _, foo2 = %w(1 2).map do |version|
spec = quick_gem 'sff', version do |s|
s.files << discover_path
end
@@ -709,7 +715,7 @@ class TestGem < Gem::TestCase
end
spec
- }
+ end
Gem.refresh
@@ -1087,7 +1093,7 @@ class TestGem < Gem::TestCase
def test_self_post_build
assert_equal 1, Gem.post_build_hooks.length
- Gem.post_build do |installer| end
+ Gem.post_build { |installer| }
assert_equal 2, Gem.post_build_hooks.length
end
@@ -1095,7 +1101,7 @@ class TestGem < Gem::TestCase
def test_self_post_install
assert_equal 1, Gem.post_install_hooks.length
- Gem.post_install do |installer| end
+ Gem.post_install { |installer| }
assert_equal 2, Gem.post_install_hooks.length
end
@@ -1103,7 +1109,7 @@ class TestGem < Gem::TestCase
def test_self_done_installing
assert_empty Gem.done_installing_hooks
- Gem.done_installing do |gems| end
+ Gem.done_installing { |gems| }
assert_equal 1, Gem.done_installing_hooks.length
end
@@ -1119,7 +1125,7 @@ class TestGem < Gem::TestCase
def test_self_post_uninstall
assert_equal 1, Gem.post_uninstall_hooks.length
- Gem.post_uninstall do |installer| end
+ Gem.post_uninstall { |installer| }
assert_equal 2, Gem.post_uninstall_hooks.length
end
@@ -1127,7 +1133,7 @@ class TestGem < Gem::TestCase
def test_self_pre_install
assert_equal 1, Gem.pre_install_hooks.length
- Gem.pre_install do |installer| end
+ Gem.pre_install { |installer| }
assert_equal 2, Gem.pre_install_hooks.length
end
@@ -1143,7 +1149,7 @@ class TestGem < Gem::TestCase
def test_self_pre_uninstall
assert_equal 1, Gem.pre_uninstall_hooks.length
- Gem.pre_uninstall do |installer| end
+ Gem.pre_uninstall { |installer| }
assert_equal 2, Gem.pre_uninstall_hooks.length
end
@@ -1328,7 +1334,7 @@ class TestGem < Gem::TestCase
a = util_spec "a", "1"
b = util_spec "b", "1", "c" => nil
c = util_spec "c", "2"
- d = util_spec "d", "1", {'e' => '= 1'}, "lib/d.rb"
+ d = util_spec "d", "1", {'e' => '= 1'}, "lib/d.rb"
e = util_spec "e", "1"
install_specs a, c, b, e, d
@@ -1943,4 +1949,5 @@ You may need to `gem install -g` to install missing gems
def util_cache_dir
File.join Gem.dir, "cache"
end
+
end
diff --git a/test/rubygems/test_gem_available_set.rb b/test/rubygems/test_gem_available_set.rb
index d4042c94f5..64ee9a36a9 100644
--- a/test/rubygems/test_gem_available_set.rb
+++ b/test/rubygems/test_gem_available_set.rb
@@ -68,7 +68,7 @@ class TestGemAvailableSet < Gem::TestCase
def test_best
a1, _ = util_gem 'a', '1'
- a2, _ = util_gem 'a', '2'
+ a2, _ = util_gem 'a', '2'
set = Gem::AvailableSet.new
set.add a1, @source
@@ -97,7 +97,7 @@ class TestGemAvailableSet < Gem::TestCase
def test_sorted_normal_versions
a1, _ = util_gem 'a', '1'
- a2, _ = util_gem 'a', '2'
+ a2, _ = util_gem 'a', '2'
set = Gem::AvailableSet.new
set.add a1, @source
@@ -127,4 +127,5 @@ class TestGemAvailableSet < Gem::TestCase
assert_equal [a3a, a2, a2a, a1, a1a], g
end
+
end
diff --git a/test/rubygems/test_gem_bundler_version_finder.rb b/test/rubygems/test_gem_bundler_version_finder.rb
index 3b63b89423..8e883bc719 100644
--- a/test/rubygems/test_gem_bundler_version_finder.rb
+++ b/test/rubygems/test_gem_bundler_version_finder.rb
@@ -2,7 +2,10 @@
require 'rubygems/test_case'
class TestGemBundlerVersionFinder < Gem::TestCase
+
def setup
+ super
+
@argv = ARGV.dup
@env = ENV.to_hash.clone
ENV.delete("BUNDLER_VERSION")
@@ -13,6 +16,8 @@ class TestGemBundlerVersionFinder < Gem::TestCase
ARGV.replace @argv
ENV.replace @env
$0 = @dollar_0
+
+ super
end
def bvf
@@ -123,4 +128,5 @@ class TestGemBundlerVersionFinder < Gem::TestCase
bvf.filter!(specs)
specs
end
+
end
diff --git a/test/rubygems/test_gem_command.rb b/test/rubygems/test_gem_command.rb
index 8caa9c6e2e..f3897c7102 100644
--- a/test/rubygems/test_gem_command.rb
+++ b/test/rubygems/test_gem_command.rb
@@ -3,7 +3,9 @@ require 'rubygems/test_case'
require 'rubygems/command'
class Gem::Command
+
public :parser
+
end
class TestGemCommand < Gem::TestCase
@@ -15,7 +17,7 @@ class TestGemCommand < Gem::TestCase
@common_options = Gem::Command.common_options.dup
Gem::Command.common_options.clear
- Gem::Command.common_options << [
+ Gem::Command.common_options << [
['-x', '--exe', 'Execute'], lambda do |*a|
@xopt = true
end
@@ -32,7 +34,7 @@ class TestGemCommand < Gem::TestCase
def test_self_add_specific_extra_args
added_args = %w[--all]
- @cmd.add_option '--all' do |v,o| end
+ @cmd.add_option('--all') { |v,o| }
Gem::Command.add_specific_extra_args @cmd_name, added_args
@@ -96,7 +98,7 @@ class TestGemCommand < Gem::TestCase
def test_invoke_with_bad_options
use_ui @ui do
- @cmd.when_invoked do true end
+ @cmd.when_invoked { true }
ex = assert_raises OptionParser::InvalidOption do
@cmd.invoke('-zzz')
@@ -107,7 +109,7 @@ class TestGemCommand < Gem::TestCase
end
def test_invoke_with_common_options
- @cmd.when_invoked do true end
+ @cmd.when_invoked { true }
use_ui @ui do
@cmd.invoke "-x"
@@ -195,6 +197,93 @@ class TestGemCommand < Gem::TestCase
assert_equal ['-h', 'command'], args
end
+ def test_deprecate_option_long_name
+ deprecate_msg = <<-EXPECTED
+WARNING: The \"--test\" option has been deprecated and will be removed in Rubygems 3.1, its use is discouraged.
+ EXPECTED
+
+ testCommand = Class.new(Gem::Command) do
+ def initialize
+ super('test', 'Gem::Command instance for testing')
+
+ add_option('-t', '--test', 'Test command') do |value, options|
+ options[:test] = true
+ end
+
+ deprecate_option(long_name: '--test', version: '3.1')
+ end
+
+ def execute
+ true
+ end
+ end
+
+ cmd = testCommand.new
+
+ use_ui @ui do
+ cmd.invoke("--test")
+ assert_equal deprecate_msg, @ui.error
+ end
+ end
+
+ def test_deprecate_option_no_version
+ deprecate_msg = <<-EXPECTED
+WARNING: The \"--test\" option has been deprecated and will be removed in future versions of Rubygems, its use is discouraged.
+ EXPECTED
+
+ testCommand = Class.new(Gem::Command) do
+ def initialize
+ super('test', 'Gem::Command instance for testing')
+
+ add_option('-t', '--test', 'Test command') do |value, options|
+ options[:test] = true
+ end
+
+ deprecate_option(long_name: '--test')
+ end
+
+ def execute
+ true
+ end
+ end
+
+ cmd = testCommand.new
+
+ use_ui @ui do
+ cmd.invoke("--test")
+ assert_equal deprecate_msg, @ui.error
+ end
+ end
+
+ def test_deprecate_option_short_name
+ deprecate_msg = <<-EXPECTED
+WARNING: The \"-t\" option has been deprecated and will be removed in Rubygems 3.5, its use is discouraged.
+ EXPECTED
+
+ testCommand = Class.new(Gem::Command) do
+ def initialize
+ super('test', 'Gem::Command instance for testing')
+
+ add_option('-t', '--test', 'Test command') do |value, options|
+ options[:test] = true
+ end
+
+ deprecate_option(short_name: '-t', version: '3.5')
+ end
+
+ def execute
+ true
+ end
+ end
+
+ cmd = testCommand.new
+
+ use_ui @ui do
+ cmd.invoke("-t")
+ assert_equal deprecate_msg, @ui.error
+ end
+ end
+
def test_show_lookup_failure_suggestions_local
correct = "non_existent_with_hint"
misspelled = "nonexistent_with_hint"
diff --git a/test/rubygems/test_gem_commands_cleanup_command.rb b/test/rubygems/test_gem_commands_cleanup_command.rb
index fdcd71ed8a..3494085a64 100644
--- a/test/rubygems/test_gem_commands_cleanup_command.rb
+++ b/test/rubygems/test_gem_commands_cleanup_command.rb
@@ -56,8 +56,13 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
end
def test_execute_all_dependencies
- @b_1 = util_spec 'b', 1 do |s| s.add_dependency 'a', '1' end
- @b_2 = util_spec 'b', 2 do |s| s.add_dependency 'a', '2' end
+ @b_1 = util_spec 'b', 1 do |s|
+ s.add_dependency 'a', '1'
+ end
+
+ @b_2 = util_spec 'b', 2 do |s|
+ s.add_dependency 'a', '2'
+ end
install_gem @b_1
install_gem @b_2
@@ -71,8 +76,13 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
end
def test_execute_dev_dependencies
- @b_1 = util_spec 'b', 1 do |s| s.add_development_dependency 'a', '1' end
- @c_1 = util_spec 'c', 1 do |s| s.add_development_dependency 'a', '2' end
+ @b_1 = util_spec 'b', 1 do |s|
+ s.add_development_dependency 'a', '1'
+ end
+
+ @c_1 = util_spec 'c', 1 do |s|
+ s.add_development_dependency 'a', '2'
+ end
install_gem @b_1
install_gem @c_1
@@ -85,8 +95,13 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
end
def test_execute_without_dev_dependencies
- @b_1 = util_spec 'b', 1 do |s| s.add_development_dependency 'a', '1' end
- @c_1 = util_spec 'c', 1 do |s| s.add_development_dependency 'a', '2' end
+ @b_1 = util_spec 'b', 1 do |s|
+ s.add_development_dependency 'a', '1'
+ end
+
+ @c_1 = util_spec 'c', 1 do |s|
+ s.add_development_dependency 'a', '2'
+ end
install_gem @b_1
install_gem @c_1
@@ -263,4 +278,5 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
assert_path_exists d_1.gem_dir
assert_path_exists d_2.gem_dir
end
+
end
diff --git a/test/rubygems/test_gem_commands_environment_command.rb b/test/rubygems/test_gem_commands_environment_command.rb
index 1451f03982..074df19e52 100644
--- a/test/rubygems/test_gem_commands_environment_command.rb
+++ b/test/rubygems/test_gem_commands_environment_command.rb
@@ -152,4 +152,5 @@ class TestGemCommandsEnvironmentCommand < Gem::TestCase
assert_equal "#{Gem.platforms.join File::PATH_SEPARATOR}\n", @ui.output
assert_equal '', @ui.error
end
+
end
diff --git a/test/rubygems/test_gem_commands_help_command.rb b/test/rubygems/test_gem_commands_help_command.rb
index 55bc797b28..8fcff6b1e7 100644
--- a/test/rubygems/test_gem_commands_help_command.rb
+++ b/test/rubygems/test_gem_commands_help_command.rb
@@ -7,6 +7,7 @@ require "rubygems/command_manager"
require File.expand_path('../rubygems_plugin', __FILE__)
class TestGemCommandsHelpCommand < Gem::TestCase
+
# previously this was calc'd in setup, but 1.8.7 had
# intermittent failures, but no issues with above require
PLUGIN = File.expand_path('../rubygems_plugin.rb', __FILE__)
@@ -75,4 +76,5 @@ class TestGemCommandsHelpCommand < Gem::TestCase
yield @ui.output, @ui.error
end
+
end
diff --git a/test/rubygems/test_gem_commands_info_command.rb b/test/rubygems/test_gem_commands_info_command.rb
index 83b18c5036..373fccceee 100644
--- a/test/rubygems/test_gem_commands_info_command.rb
+++ b/test/rubygems/test_gem_commands_info_command.rb
@@ -41,4 +41,5 @@ class TestGemCommandsInfoCommand < Gem::TestCase
assert_match %r%#{@gem.summary}\n%, @ui.output
assert_match "", @ui.error
end
+
end
diff --git a/test/rubygems/test_gem_commands_install_command.rb b/test/rubygems/test_gem_commands_install_command.rb
index 0976a31b50..21aa29822f 100644
--- a/test/rubygems/test_gem_commands_install_command.rb
+++ b/test/rubygems/test_gem_commands_install_command.rb
@@ -1142,4 +1142,59 @@ ERROR: Possible alternatives: non_existent_with_hint
assert_equal [:test, :development], @cmd.options[:without_groups]
end
+ def test_explain_platform_local
+ local = Gem::Platform.local
+ spec_fetcher do |fetcher|
+ fetcher.spec 'a', 2
+
+ fetcher.spec 'a', 2 do |s|
+ s.platform = local
+ end
+ end
+
+ @cmd.options[:explain] = true
+ @cmd.options[:args] = %w[a]
+
+ use_ui @ui do
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
+ @cmd.execute
+ end
+ end
+
+ out = @ui.output.split "\n"
+
+ assert_equal "Gems to install:", out.shift
+ assert_equal " a-2-#{local}", out.shift
+ assert_empty out
+ end
+
+ def test_explain_platform_ruby
+ local = Gem::Platform.local
+ spec_fetcher do |fetcher|
+ fetcher.spec 'a', 2
+
+ fetcher.spec 'a', 2 do |s|
+ s.platform = local
+ end
+ end
+
+ # equivalent to --platform=ruby
+ Gem.platforms = [Gem::Platform::RUBY]
+
+ @cmd.options[:explain] = true
+ @cmd.options[:args] = %w[a]
+
+ use_ui @ui do
+ assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
+ @cmd.execute
+ end
+ end
+
+ out = @ui.output.split "\n"
+
+ assert_equal "Gems to install:", out.shift
+ assert_equal " a-2", out.shift
+ assert_empty out
+ end
+
end
diff --git a/test/rubygems/test_gem_commands_mirror.rb b/test/rubygems/test_gem_commands_mirror.rb
index 1a29755911..07ec9f3d0c 100644
--- a/test/rubygems/test_gem_commands_mirror.rb
+++ b/test/rubygems/test_gem_commands_mirror.rb
@@ -3,6 +3,7 @@ require 'rubygems/test_case'
require 'rubygems/commands/mirror_command'
class TestGemCommandsMirrorCommand < Gem::TestCase
+
def setup
super
diff --git a/test/rubygems/test_gem_commands_outdated_command.rb b/test/rubygems/test_gem_commands_outdated_command.rb
index 3b0220e84b..3c37e22a09 100644
--- a/test/rubygems/test_gem_commands_outdated_command.rb
+++ b/test/rubygems/test_gem_commands_outdated_command.rb
@@ -29,4 +29,5 @@ class TestGemCommandsOutdatedCommand < Gem::TestCase
assert_equal "foo (0.2 < 2.0)\n", @ui.output
assert_equal "", @ui.error
end
+
end
diff --git a/test/rubygems/test_gem_commands_pristine_command.rb b/test/rubygems/test_gem_commands_pristine_command.rb
index e4aa8d8656..c8e3bec88e 100644
--- a/test/rubygems/test_gem_commands_pristine_command.rb
+++ b/test/rubygems/test_gem_commands_pristine_command.rb
@@ -54,7 +54,10 @@ class TestGemCommandsPristineCommand < Gem::TestCase
end
def test_execute_all
- a = util_spec 'a' do |s| s.executables = %w[foo] end
+ a = util_spec 'a' do |s|
+ s.executables = %w[foo]
+ end
+
write_file File.join(@tempdir, 'bin', 'foo') do |fp|
fp.puts "#!/usr/bin/ruby"
end
@@ -116,7 +119,9 @@ class TestGemCommandsPristineCommand < Gem::TestCase
end
def test_execute_extensions_explicit
- a = util_spec 'a' do |s| s.extensions << 'ext/a/extconf.rb' end
+ a = util_spec 'a' do |s|
+ s.extensions << 'ext/a/extconf.rb'
+ end
ext_path = File.join @tempdir, 'ext', 'a', 'extconf.rb'
write_file ext_path do |io|
@@ -152,7 +157,9 @@ class TestGemCommandsPristineCommand < Gem::TestCase
end
def test_execute_no_extension
- a = util_spec 'a' do |s| s.extensions << 'ext/a/extconf.rb' end
+ a = util_spec 'a' do |s|
+ s.extensions << 'ext/a/extconf.rb'
+ end
ext_path = File.join @tempdir, 'ext', 'a', 'extconf.rb'
write_file ext_path do |io|
@@ -178,7 +185,9 @@ class TestGemCommandsPristineCommand < Gem::TestCase
end
def test_execute_with_extension_with_build_args
- a = util_spec 'a' do |s| s.extensions << 'ext/a/extconf.rb' end
+ a = util_spec 'a' do |s|
+ s.extensions << 'ext/a/extconf.rb'
+ end
ext_path = File.join @tempdir, 'ext', 'a', 'extconf.rb'
write_file ext_path do |io|
diff --git a/test/rubygems/test_gem_commands_push_command.rb b/test/rubygems/test_gem_commands_push_command.rb
index 592295d684..185d3cc1fc 100644
--- a/test/rubygems/test_gem_commands_push_command.rb
+++ b/test/rubygems/test_gem_commands_push_command.rb
@@ -28,11 +28,13 @@ class TestGemCommandsPushCommand < Gem::TestCase
@cmd = Gem::Commands::PushCommand.new
class << Gem
+
alias_method :orig_latest_rubygems_version, :latest_rubygems_version
def latest_rubygems_version
Gem.rubygems_version
end
+
end
end
@@ -40,8 +42,10 @@ class TestGemCommandsPushCommand < Gem::TestCase
super
class << Gem
+
remove_method :latest_rubygems_version
alias_method :latest_rubygems_version, :orig_latest_rubygems_version
+
end
end
@@ -132,7 +136,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
ENV["RUBYGEMS_HOST"] = @host
Gem.configuration.disable_default_gem_server = true
@response = "Successfully registered gem: freewill (1.0.0)"
- @fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, 'OK']
+ @fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, 'OK']
send_battery
end
@@ -160,14 +164,14 @@ class TestGemCommandsPushCommand < Gem::TestCase
FileUtils.rm Gem.configuration.credentials_path
@response = "Successfully registered gem: freebird (1.0.1)"
- @fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, 'OK']
+ @fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, 'OK']
send_battery
end
def test_sending_gem
@response = "Successfully registered gem: freewill (1.0.0)"
- @fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, 'OK']
+ @fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, 'OK']
send_battery
end
@@ -195,7 +199,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
FileUtils.rm Gem.configuration.credentials_path
@response = "Successfully registered gem: freebird (1.0.1)"
- @fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, 'OK']
+ @fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, 'OK']
send_battery
end
@@ -210,7 +214,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
ENV["GEM_HOST_API_KEY"] = "PRIVKEY"
@response = "Successfully registered gem: freebird (1.0.1)"
- @fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, 'OK']
+ @fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, 'OK']
send_battery
end
@@ -237,7 +241,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
FileUtils.rm Gem.configuration.credentials_path
@response = "Successfully registered gem: freebird (1.0.1)"
- @fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, 'OK']
+ @fetcher.data["#{@host}/api/v1/gems"] = [@response, 200, 'OK']
send_battery
end
@@ -311,7 +315,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
FileUtils.rm Gem.configuration.credentials_path
@response = "Successfully registered gem: freebird (1.0.1)"
- @fetcher.data["#{host}/api/v1/gems"] = [@response, 200, 'OK']
+ @fetcher.data["#{host}/api/v1/gems"] = [@response, 200, 'OK']
# do not set @host
use_ui(@ui) { @cmd.send_gem(@path) }
diff --git a/test/rubygems/test_gem_commands_query_command.rb b/test/rubygems/test_gem_commands_query_command.rb
index 7957689db4..71cf386026 100644
--- a/test/rubygems/test_gem_commands_query_command.rb
+++ b/test/rubygems/test_gem_commands_query_command.rb
@@ -19,6 +19,7 @@ module TestGemCommandsQueryCommandSetup
end
class TestGemCommandsQueryCommandWithInstalledGems < Gem::TestCase
+
include TestGemCommandsQueryCommandSetup
def test_execute
@@ -585,9 +586,11 @@ pl (1 i386-linux)
fetcher.spec 'a', '3.a'
end
end
+
end
class TestGemCommandsQueryCommandWithoutInstalledGems < Gem::TestCase
+
include TestGemCommandsQueryCommandSetup
def test_execute_platform
@@ -829,4 +832,5 @@ othergem (1.2.3)
fetcher.download 'a', '3.a'
end
end
+
end
diff --git a/test/rubygems/test_gem_commands_setup_command.rb b/test/rubygems/test_gem_commands_setup_command.rb
index 4f34112099..569091a8a7 100644
--- a/test/rubygems/test_gem_commands_setup_command.rb
+++ b/test/rubygems/test_gem_commands_setup_command.rb
@@ -23,17 +23,36 @@ class TestGemCommandsSetupCommand < Gem::TestCase
FileUtils.mkdir_p 'bin'
FileUtils.mkdir_p 'lib/rubygems/ssl_certs/rubygems.org'
- File.open 'bin/gem', 'w' do |io| io.puts '# gem' end
- File.open 'lib/rubygems.rb', 'w' do |io| io.puts '# rubygems.rb' end
- File.open 'lib/rubygems/test_case.rb', 'w' do |io| io.puts '# test_case.rb' end
- File.open 'lib/rubygems/ssl_certs/rubygems.org/foo.pem', 'w' do |io| io.puts 'PEM' end
+ File.open 'bin/gem', 'w' do
+ |io| io.puts '# gem'
+ end
+
+ File.open 'lib/rubygems.rb', 'w' do |io|
+ io.puts '# rubygems.rb'
+ end
+
+ File.open 'lib/rubygems/test_case.rb', 'w' do |io|
+ io.puts '# test_case.rb'
+ end
+
+ File.open 'lib/rubygems/ssl_certs/rubygems.org/foo.pem', 'w' do |io|
+ io.puts 'PEM'
+ end
FileUtils.mkdir_p 'bundler/exe'
FileUtils.mkdir_p 'bundler/lib/bundler'
- File.open 'bundler/exe/bundle', 'w' do |io| io.puts '# bundle' end
- File.open 'bundler/lib/bundler.rb', 'w' do |io| io.puts '# bundler.rb' end
- File.open 'bundler/lib/bundler/b.rb', 'w' do |io| io.puts '# b.rb' end
+ File.open 'bundler/exe/bundle', 'w' do |io|
+ io.puts '# bundle'
+ end
+
+ File.open 'bundler/lib/bundler.rb', 'w' do |io|
+ io.puts '# bundler.rb'
+ end
+
+ File.open 'bundler/lib/bundler/b.rb', 'w' do |io|
+ io.puts '# b.rb'
+ end
FileUtils.mkdir_p 'default/gems'
@@ -220,14 +239,29 @@ class TestGemCommandsSetupCommand < Gem::TestCase
FileUtils.mkdir_p lib_rubygems_defaults
FileUtils.mkdir_p lib_bundler
- File.open securerandom_rb, 'w' do |io| io.puts '# securerandom.rb' end
+ File.open securerandom_rb, 'w' do |io|
+ io.puts '# securerandom.rb'
+ end
+
+ File.open old_builder_rb, 'w' do |io|
+ io.puts '# builder.rb'
+ end
+
+ File.open old_format_rb, 'w' do |io|
+ io.puts '# format.rb'
+ end
- File.open old_builder_rb, 'w' do |io| io.puts '# builder.rb' end
- File.open old_format_rb, 'w' do |io| io.puts '# format.rb' end
- File.open old_bundler_c_rb, 'w' do |io| io.puts '# c.rb' end
+ File.open old_bundler_c_rb, 'w' do |io|
+ io.puts '# c.rb'
+ end
- File.open engine_defaults_rb, 'w' do |io| io.puts '# jruby.rb' end
- File.open os_defaults_rb, 'w' do |io| io.puts '# operating_system.rb' end
+ File.open engine_defaults_rb, 'w' do |io|
+ io.puts '# jruby.rb'
+ end
+
+ File.open os_defaults_rb, 'w' do |io|
+ io.puts '# operating_system.rb'
+ end
@cmd.remove_old_lib_files lib
diff --git a/test/rubygems/test_gem_commands_signin_command.rb b/test/rubygems/test_gem_commands_signin_command.rb
index afcb8d6d99..6276ea0264 100644
--- a/test/rubygems/test_gem_commands_signin_command.rb
+++ b/test/rubygems/test_gem_commands_signin_command.rb
@@ -26,7 +26,7 @@ class TestGemCommandsSigninCommand < Gem::TestCase
end
def test_execute_when_already_signed_in_with_same_host
- host = 'http://some-gemcutter-compatible-host.org'
+ host = 'http://some-gemcutter-compatible-host.org'
util_capture(nil, host) { @cmd.execute }
old_credentials = YAML.load_file Gem.configuration.credentials_path
@@ -38,10 +38,10 @@ class TestGemCommandsSigninCommand < Gem::TestCase
end
def test_execute_when_already_signed_in_with_different_host
- api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf04045xxxx'
+ api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf04045xxxx'
util_capture(nil, nil, api_key) { @cmd.execute }
- host = 'http://some-gemcutter-compatible-host.org'
+ host = 'http://some-gemcutter-compatible-host.org'
util_capture(nil, host, api_key) { @cmd.execute }
credentials = YAML.load_file Gem.configuration.credentials_path
@@ -95,4 +95,5 @@ class TestGemCommandsSigninCommand < Gem::TestCase
sign_in_ui
end
+
end
diff --git a/test/rubygems/test_gem_commands_sources_command.rb b/test/rubygems/test_gem_commands_sources_command.rb
index ad92c26073..1e58643566 100644
--- a/test/rubygems/test_gem_commands_sources_command.rb
+++ b/test/rubygems/test_gem_commands_sources_command.rb
@@ -40,9 +40,9 @@ class TestGemCommandsSourcesCommand < Gem::TestCase
fetcher.spec 'a', 1
end
- specs = Gem::Specification.map { |spec|
+ specs = Gem::Specification.map do |spec|
[spec.name, spec.version, spec.original_platform]
- }
+ end
specs_dump_gz = StringIO.new
Zlib::GzipWriter.wrap specs_dump_gz do |io|
@@ -167,9 +167,9 @@ source http://gems.example.com/ already present in the cache
fetcher.spec 'a', 1
end
- specs = Gem::Specification.map { |spec|
+ specs = Gem::Specification.map do |spec|
[spec.name, spec.version, spec.original_platform]
- }
+ end
specs_dump_gz = StringIO.new
Zlib::GzipWriter.wrap specs_dump_gz do |io|
diff --git a/test/rubygems/test_gem_commands_uninstall_command.rb b/test/rubygems/test_gem_commands_uninstall_command.rb
index 407d2451a6..efe5a768ef 100644
--- a/test/rubygems/test_gem_commands_uninstall_command.rb
+++ b/test/rubygems/test_gem_commands_uninstall_command.rb
@@ -54,7 +54,10 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
util_build_gem c
installer = util_installer c, @gemhome
- use_ui @ui do installer.install end
+
+ use_ui @ui do
+ installer.install
+ end
ui = Gem::MockGemUi.new
@@ -92,7 +95,9 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
# Evil hack to prevent false removal success
FileUtils.rm_f @executable
- File.open @executable, "wb+" do |f| f.puts "binary" end
+ File.open @executable, "wb+" do |f|
+ f.puts "binary"
+ end
@cmd.options[:executables] = true
@cmd.options[:args] = [@spec.name]
@@ -366,4 +371,5 @@ WARNING: Use your OS package manager to uninstall vendor gems
assert_empty @ui.output
assert_match %r!Error: unable to successfully uninstall '#{@spec.name}'!, @ui.error
end
+
end
diff --git a/test/rubygems/test_gem_commands_update_command.rb b/test/rubygems/test_gem_commands_update_command.rb
index 549e34c218..0247a03477 100644
--- a/test/rubygems/test_gem_commands_update_command.rb
+++ b/test/rubygems/test_gem_commands_update_command.rb
@@ -66,7 +66,9 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
def test_execute_system
spec_fetcher do |fetcher|
- fetcher.download 'rubygems-update', 9 do |s| s.files = %w[setup.rb] end
+ fetcher.download 'rubygems-update', 9 do |s|
+ s.files = %w[setup.rb]
+ end
end
@cmd.options[:args] = []
@@ -107,8 +109,13 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
def test_execute_system_multiple
spec_fetcher do |fetcher|
- fetcher.download 'rubygems-update', 8 do |s| s.files = %w[setup.rb] end
- fetcher.download 'rubygems-update', 9 do |s| s.files = %w[setup.rb] end
+ fetcher.download 'rubygems-update', 8 do |s|
+ s.files = %w[setup.rb]
+ end
+
+ fetcher.download 'rubygems-update', 9 do |s|
+ s.files = %w[setup.rb]
+ end
end
@cmd.options[:args] = []
@@ -128,8 +135,13 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
def test_execute_system_specific
spec_fetcher do |fetcher|
- fetcher.download 'rubygems-update', 8 do |s| s.files = %w[setup.rb] end
- fetcher.download 'rubygems-update', 9 do |s| s.files = %w[setup.rb] end
+ fetcher.download 'rubygems-update', 8 do |s|
+ s.files = %w[setup.rb]
+ end
+
+ fetcher.download 'rubygems-update', 9 do |s|
+ s.files = %w[setup.rb]
+ end
end
@cmd.options[:args] = []
@@ -149,8 +161,13 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
def test_execute_system_specifically_to_latest_version
spec_fetcher do |fetcher|
- fetcher.download 'rubygems-update', 8 do |s| s.files = %w[setup.rb] end
- fetcher.download 'rubygems-update', 9 do |s| s.files = %w[setup.rb] end
+ fetcher.download 'rubygems-update', 8 do |s|
+ s.files = %w[setup.rb]
+ end
+
+ fetcher.download 'rubygems-update', 9 do |s|
+ s.files = %w[setup.rb]
+ end
end
@cmd.options[:args] = []
@@ -387,7 +404,10 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
specs = spec_fetcher do |fetcher|
fetcher.spec 'a', 1
fetcher.spec 'a', 2
- fetcher.spec 'a', 2 do |s| s.platform = platform end
+
+ fetcher.spec 'a', 2 do |s|
+ s.platform = platform
+ end
end
expected = [
@@ -522,4 +542,5 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
assert_equal " a-2", out.shift
assert_empty out
end
+
end
diff --git a/test/rubygems/test_gem_commands_yank_command.rb b/test/rubygems/test_gem_commands_yank_command.rb
index d30c386aa6..666779a4ac 100644
--- a/test/rubygems/test_gem_commands_yank_command.rb
+++ b/test/rubygems/test_gem_commands_yank_command.rb
@@ -3,6 +3,7 @@ require 'rubygems/test_case'
require 'rubygems/commands/yank_command'
class TestGemCommandsYankCommand < Gem::TestCase
+
def setup
super
@@ -12,7 +13,7 @@ class TestGemCommandsYankCommand < Gem::TestCase
@fetcher = Gem::RemoteFetcher.fetcher
Gem.configuration.rubygems_api_key = 'key'
- Gem.configuration.api_keys[:KEY] = 'other'
+ Gem.configuration.api_keys[:KEY] = 'other'
end
def test_handle_options
diff --git a/test/rubygems/test_gem_config_file.rb b/test/rubygems/test_gem_config_file.rb
index 192699aaba..858d268d79 100644
--- a/test/rubygems/test_gem_config_file.rb
+++ b/test/rubygems/test_gem_config_file.rb
@@ -489,4 +489,5 @@ if you believe they were disclosed to a third party.
util_config_file
assert_equal(true, @cfg.disable_default_gem_server)
end
+
end
diff --git a/test/rubygems/test_gem_dependency_installer.rb b/test/rubygems/test_gem_dependency_installer.rb
index 74b7a6a83e..bf65cf9ed3 100644
--- a/test/rubygems/test_gem_dependency_installer.rb
+++ b/test/rubygems/test_gem_dependency_installer.rb
@@ -26,18 +26,22 @@ class TestGemDependencyInstaller < Gem::TestCase
end
def util_setup_gems
- @a1, @a1_gem = util_gem 'a', '1' do |s| s.executables << 'a_bin' end
+ @a1, @a1_gem = util_gem 'a', '1' do |s|
+ s.executables << 'a_bin'
+ end
+
@a1_pre, @a1_pre_gem = util_gem 'a', '1.a'
+
@b1, @b1_gem = util_gem 'b', '1' do |s|
s.add_dependency 'a'
s.add_development_dependency 'aa'
end
- @c1, @c1_gem = util_gem 'c', '1' do |s|
+ @c1, @c1_gem = util_gem 'c', '1' do |s|
s.add_development_dependency 'b'
end
- @d1, @d1_gem = util_gem 'd', '1' do |s|
+ @d1, @d1_gem = util_gem 'd', '1' do |s|
s.add_development_dependency 'c'
end
@@ -872,8 +876,13 @@ class TestGemDependencyInstaller < Gem::TestCase
a1_data = nil
a2_o_data = nil
- File.open @a1_gem, 'rb' do |fp| a1_data = fp.read end
- File.open a2_o_gem, 'rb' do |fp| a2_o_data = fp.read end
+ File.open @a1_gem, 'rb' do |fp|
+ a1_data = fp.read
+ end
+
+ File.open a2_o_gem, 'rb' do |fp|
+ a2_o_data = fp.read
+ end
@fetcher.data["http://gems.example.com/gems/#{@a1.file_name}"] =
a1_data
@@ -1235,4 +1244,5 @@ class TestGemDependencyInstaller < Gem::TestCase
util_clear_gems
end
+
end
diff --git a/test/rubygems/test_gem_dependency_list.rb b/test/rubygems/test_gem_dependency_list.rb
index 9bd6ceb6f3..019cb33973 100644
--- a/test/rubygems/test_gem_dependency_list.rb
+++ b/test/rubygems/test_gem_dependency_list.rb
@@ -16,13 +16,23 @@ class TestGemDependencyList < Gem::TestCase
@a2 = util_spec 'a', '2'
@a3 = util_spec 'a', '3'
- @b1 = util_spec 'b', '1' do |s| s.add_dependency 'a', '>= 1' end
- @b2 = util_spec 'b', '2' do |s| s.add_dependency 'a', '>= 1' end
+ @b1 = util_spec 'b', '1' do |s|
+ s.add_dependency 'a', '>= 1'
+ end
+
+ @b2 = util_spec 'b', '2' do |s|
+ s.add_dependency 'a', '>= 1'
+ end
+
+ @c1 = util_spec 'c', '1' do |s|
+ s.add_dependency 'b', '>= 1'
+ end
- @c1 = util_spec 'c', '1' do |s| s.add_dependency 'b', '>= 1' end
@c2 = util_spec 'c', '2'
- @d1 = util_spec 'd', '1' do |s| s.add_dependency 'c', '>= 1' end
+ @d1 = util_spec 'd', '1' do |s|
+ s.add_dependency 'c', '>= 1'
+ end
end
def test_active_count
@@ -165,8 +175,13 @@ class TestGemDependencyList < Gem::TestCase
a1 = util_spec 'a', '1'
a2 = util_spec 'a', '2'
- b = util_spec 'b', '1' do |s| s.add_dependency 'a', '= 1' end
- c = util_spec 'c', '1' do |s| s.add_dependency 'a', '= 2' end
+ b = util_spec 'b', '1' do |s|
+ s.add_dependency 'a', '= 1'
+ end
+
+ c = util_spec 'c', '1' do |s|
+ s.add_dependency 'a', '= 2'
+ end
d = util_spec 'd', '1' do |s|
s.add_dependency 'b'
diff --git a/test/rubygems/test_gem_ext_builder.rb b/test/rubygems/test_gem_ext_builder.rb
index ce04762e84..46a4385750 100644
--- a/test/rubygems/test_gem_ext_builder.rb
+++ b/test/rubygems/test_gem_ext_builder.rb
@@ -134,6 +134,7 @@ install:
def test_build_extensions_install_ext_only
class << Gem
+
alias orig_install_extension_in_lib install_extension_in_lib
remove_method :install_extension_in_lib
@@ -141,6 +142,7 @@ install:
def Gem.install_extension_in_lib
false
end
+
end
@spec.extensions << 'ext/extconf.rb'
@@ -177,9 +179,11 @@ install:
refute_path_exists File.join @spec.gem_dir, 'lib', 'a', 'b.rb'
ensure
class << Gem
+
remove_method :install_extension_in_lib
alias install_extension_in_lib orig_install_extension_in_lib
+
end
end
diff --git a/test/rubygems/test_gem_ext_rake_builder.rb b/test/rubygems/test_gem_ext_rake_builder.rb
index 6b647293a8..c86ff07649 100644
--- a/test/rubygems/test_gem_ext_rake_builder.rb
+++ b/test/rubygems/test_gem_ext_rake_builder.rb
@@ -3,6 +3,7 @@ require 'rubygems/test_case'
require 'rubygems/ext'
class TestGemExtRakeBuilder < Gem::TestCase
+
def setup
super
@@ -90,4 +91,5 @@ class TestGemExtRakeBuilder < Gem::TestCase
EO_MKRF
end
end
+
end
diff --git a/test/rubygems/test_gem_gemcutter_utilities.rb b/test/rubygems/test_gem_gemcutter_utilities.rb
index 4315090a3d..03bb78271b 100644
--- a/test/rubygems/test_gem_gemcutter_utilities.rb
+++ b/test/rubygems/test_gem_gemcutter_utilities.rb
@@ -90,7 +90,7 @@ class TestGemGemcutterUtilities < Gem::TestCase
end
def test_sign_in
- api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
+ api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
util_sign_in [api_key, 200, 'OK']
assert_match %r{Enter your RubyGems.org credentials.}, @sign_in_ui.output
@@ -102,7 +102,7 @@ class TestGemGemcutterUtilities < Gem::TestCase
end
def test_sign_in_with_host
- api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
+ api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
util_sign_in [api_key, 200, 'OK'], 'http://example.com', ['http://example.com']
@@ -116,7 +116,7 @@ class TestGemGemcutterUtilities < Gem::TestCase
end
def test_sign_in_with_host_nil
- api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
+ api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
util_sign_in [api_key, 200, 'OK'], nil, [nil]
@@ -130,7 +130,7 @@ class TestGemGemcutterUtilities < Gem::TestCase
end
def test_sign_in_with_host_ENV
- api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
+ api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
util_sign_in [api_key, 200, 'OK'], 'http://example.com'
assert_match "Enter your http://example.com credentials.",
@@ -143,7 +143,7 @@ class TestGemGemcutterUtilities < Gem::TestCase
end
def test_sign_in_skips_with_existing_credentials
- api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
+ api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
Gem.configuration.rubygems_api_key = api_key
util_sign_in [api_key, 200, 'OK']
@@ -152,8 +152,8 @@ class TestGemGemcutterUtilities < Gem::TestCase
end
def test_sign_in_skips_with_key_override
- api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
- Gem.configuration.api_keys[:KEY] = 'other'
+ api_key = 'a5fdbb6ba150cbb83aad2bb2fede64cf040453903'
+ Gem.configuration.api_keys[:KEY] = 'other'
@cmd.options[:key] = :KEY
util_sign_in [api_key, 200, 'OK']
@@ -173,7 +173,7 @@ class TestGemGemcutterUtilities < Gem::TestCase
assert_match %r{Enter your RubyGems.org credentials.}, @sign_in_ui.output
assert_match %r{Signed in.}, @sign_in_ui.output
- credentials = YAML.load_file Gem.configuration.credentials_path
+ credentials = YAML.load_file Gem.configuration.credentials_path
assert_equal api_key, credentials[:rubygems_api_key]
assert_equal other_api_key, credentials[:other_api_key]
end
diff --git a/test/rubygems/test_gem_indexer.rb b/test/rubygems/test_gem_indexer.rb
index 9f27744d48..cc83cdd81e 100644
--- a/test/rubygems/test_gem_indexer.rb
+++ b/test/rubygems/test_gem_indexer.rb
@@ -37,6 +37,13 @@ class TestGemIndexer < Gem::TestCase
@indexer = Gem::Indexer.new(@tempdir)
end
+ def teardown
+ super
+
+ util_clear_gems
+ util_clear_default_gems
+ end
+
def test_initialize
assert_equal @tempdir, @indexer.dest_directory
assert_match %r{#{Dir.mktmpdir('gem_generate_index').match(/.*-/)}}, @indexer.directory
diff --git a/test/rubygems/test_gem_install_update_options.rb b/test/rubygems/test_gem_install_update_options.rb
index 65eaf7275f..dd6bd08dde 100644
--- a/test/rubygems/test_gem_install_update_options.rb
+++ b/test/rubygems/test_gem_install_update_options.rb
@@ -180,4 +180,5 @@ class TestGemInstallUpdateOptions < Gem::InstallerTestCase
assert_equal true, @cmd.options[:post_install_message]
end
+
end
diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb
index 23c153d69b..ebf23ecfcc 100644
--- a/test/rubygems/test_gem_installer.rb
+++ b/test/rubygems/test_gem_installer.rb
@@ -2,6 +2,7 @@
require 'rubygems/installer_test_case'
class TestGemInstaller < Gem::InstallerTestCase
+
@@symlink_supported = nil
def symlink_supported?
@@ -163,6 +164,8 @@ gem 'other', version
wrapper = File.read installed_exec
assert_match %r|generated by RubyGems|, wrapper
+ ensure
+ Gem::Installer.exec_format = nil
end
def test_check_executable_overwrite_other_gem
@@ -699,7 +702,10 @@ gem 'other', version
end
def test_initialize
- spec = util_spec 'a' do |s| s.platform = Gem::Platform.new 'mswin32' end
+ spec = util_spec 'a' do |s|
+ s.platform = Gem::Platform.new 'mswin32'
+ end
+
gem = File.join @tempdir, spec.file_name
Dir.mkdir util_inst_bindir
@@ -945,7 +951,10 @@ gem 'other', version
# Morph spec to have lib/other.rb instead of code.rb and recreate
@spec.files = File.join('lib', 'other.rb')
Dir.chdir @tempdir do
- File.open File.join('lib', 'other.rb'), 'w' do |f| f.puts '1' end
+ File.open File.join('lib', 'other.rb'), 'w' do |f|
+ f.puts '1'
+ end
+
use_ui ui do
FileUtils.rm @gem
Gem::Package.build @spec
@@ -1282,9 +1291,9 @@ gem 'other', version
end
# empty depend file for no auto dependencies
- @spec.files += %W"depend #{@spec.name}.c".each {|file|
+ @spec.files += %W"depend #{@spec.name}.c".each do |file|
write_file File.join(@tempdir, file)
- }
+ end
so = File.join(@spec.gem_dir, "#{@spec.name}.#{RbConfig::CONFIG["DLEXT"]}")
refute_path_exists so
@@ -1768,4 +1777,5 @@ gem 'other', version
def mask
0100755 & (~File.umask)
end
+
end
diff --git a/test/rubygems/test_gem_package.rb b/test/rubygems/test_gem_package.rb
index dfb6ea40d1..17e288998f 100644
--- a/test/rubygems/test_gem_package.rb
+++ b/test/rubygems/test_gem_package.rb
@@ -129,8 +129,13 @@ class TestGemPackage < Gem::Package::TarTestCase
FileUtils.mkdir_p 'lib/empty'
- File.open 'lib/code.rb', 'w' do |io| io.write '# lib/code.rb' end
- File.open 'lib/extra.rb', 'w' do |io| io.write '# lib/extra.rb' end
+ File.open 'lib/code.rb', 'w' do |io|
+ io.write '# lib/code.rb'
+ end
+
+ File.open 'lib/extra.rb', 'w' do |io|
+ io.write '# lib/extra.rb'
+ end
package = Gem::Package.new 'bogus.gem'
package.spec = spec
@@ -157,7 +162,10 @@ class TestGemPackage < Gem::Package::TarTestCase
spec.files = %w[lib/code.rb lib/code_sym.rb lib/code_sym2.rb]
FileUtils.mkdir_p 'lib'
- File.open 'lib/code.rb', 'w' do |io| io.write '# lib/code.rb' end
+
+ File.open 'lib/code.rb', 'w' do |io|
+ io.write '# lib/code.rb'
+ end
# NOTE: 'code.rb' is correct, because it's relative to lib/code_sym.rb
begin
@@ -433,7 +441,7 @@ class TestGemPackage < Gem::Package::TarTestCase
end
def test_extract_files_empty
- data_tgz = util_tar_gz do end
+ data_tgz = util_tar_gz { }
gem = util_tar do |tar|
tar.add_file 'data.tar.gz', 0644 do |io|
@@ -462,7 +470,9 @@ class TestGemPackage < Gem::Package::TarTestCase
package = Gem::Package.new @gem
tgz_io = util_tar_gz do |tar|
- tar.add_file '/absolute.rb', 0644 do |io| io.write 'hi' end
+ tar.add_file '/absolute.rb', 0644 do |io|
+ io.write 'hi'
+ end
end
e = assert_raises Gem::Package::PathError do
@@ -477,7 +487,10 @@ class TestGemPackage < Gem::Package::TarTestCase
package = Gem::Package.new @gem
tgz_io = util_tar_gz do |tar|
- tar.add_file 'relative.rb', 0644 do |io| io.write 'hi' end
+ tar.add_file 'relative.rb', 0644 do |io|
+ io.write 'hi'
+ end
+
tar.mkdir 'lib', 0755
tar.add_symlink 'lib/foo.rb', '../relative.rb', 0644
end
@@ -506,7 +519,9 @@ class TestGemPackage < Gem::Package::TarTestCase
tgz_io = util_tar_gz do |tar|
tar.mkdir 'lib', 0755
tar.add_symlink 'lib/link', '../..', 0644
- tar.add_file 'lib/link/outside.txt', 0644 do |io| io.write 'hi' end
+ tar.add_file 'lib/link/outside.txt', 0644 do |io|
+ io.write 'hi'
+ end
end
# Extract into a subdirectory of @destination; if this test fails it writes
@@ -534,7 +549,9 @@ class TestGemPackage < Gem::Package::TarTestCase
tgz_io = util_tar_gz do |tar|
tar.mkdir 'lib', 0755
- tar.add_file 'lib/foo.rb', 0644 do |io| io.write 'hi' end
+ tar.add_file 'lib/foo.rb', 0644 do |io|
+ io.write 'hi'
+ end
tar.mkdir 'lib/foo', 0755
end
@@ -551,7 +568,9 @@ class TestGemPackage < Gem::Package::TarTestCase
package = Gem::Package.new @gem
tgz_io = util_tar_gz do |tar|
- tar.add_file './dot_slash.rb', 0644 do |io| io.write 'hi' end
+ tar.add_file './dot_slash.rb', 0644 do |io|
+ io.write 'hi'
+ end
end
package.extract_tar_gz tgz_io, @destination
@@ -564,7 +583,9 @@ class TestGemPackage < Gem::Package::TarTestCase
package = Gem::Package.new @gem
tgz_io = util_tar_gz do |tar|
- tar.add_file '.dot_file.rb', 0644 do |io| io.write 'hi' end
+ tar.add_file '.dot_file.rb', 0644 do |io|
+ io.write 'hi'
+ end
end
package.extract_tar_gz tgz_io, @destination
@@ -578,7 +599,9 @@ class TestGemPackage < Gem::Package::TarTestCase
package = Gem::Package.new @gem
tgz_io = util_tar_gz do |tar|
- tar.add_file 'foo/file.rb', 0644 do |io| io.write 'hi' end
+ tar.add_file 'foo/file.rb', 0644 do |io|
+ io.write 'hi'
+ end
end
package.extract_tar_gz tgz_io, @destination.upcase
@@ -1043,7 +1066,9 @@ class TestGemPackage < Gem::Package::TarTestCase
tgz_io = StringIO.new
# can't wrap TarWriter because it seeks
- Zlib::GzipWriter.wrap tgz_io do |io| io.write tar_io.string end
+ Zlib::GzipWriter.wrap tgz_io do |io|
+ io.write tar_io.string
+ end
StringIO.new tgz_io.string
end
diff --git a/test/rubygems/test_gem_package_tar_reader_entry.rb b/test/rubygems/test_gem_package_tar_reader_entry.rb
index ef088e32be..4627c230d9 100644
--- a/test/rubygems/test_gem_package_tar_reader_entry.rb
+++ b/test/rubygems/test_gem_package_tar_reader_entry.rb
@@ -43,19 +43,19 @@ class TestGemPackageTarReaderEntry < Gem::Package::TarTestCase
assert @entry.bytes_read
- e = assert_raises IOError do @entry.eof? end
+ e = assert_raises(IOError) { @entry.eof? }
assert_equal 'closed Gem::Package::TarReader::Entry', e.message
- e = assert_raises IOError do @entry.getc end
+ e = assert_raises(IOError) { @entry.getc }
assert_equal 'closed Gem::Package::TarReader::Entry', e.message
- e = assert_raises IOError do @entry.pos end
+ e = assert_raises(IOError) { @entry.pos }
assert_equal 'closed Gem::Package::TarReader::Entry', e.message
- e = assert_raises IOError do @entry.read end
+ e = assert_raises(IOError) { @entry.read }
assert_equal 'closed Gem::Package::TarReader::Entry', e.message
- e = assert_raises IOError do @entry.rewind end
+ e = assert_raises(IOError) { @entry.rewind }
assert_equal 'closed Gem::Package::TarReader::Entry', e.message
end
diff --git a/test/rubygems/test_gem_package_tar_writer.rb b/test/rubygems/test_gem_package_tar_writer.rb
index 517320c011..6a940ed902 100644
--- a/test/rubygems/test_gem_package_tar_writer.rb
+++ b/test/rubygems/test_gem_package_tar_writer.rb
@@ -25,7 +25,9 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
def test_add_file
Time.stub :now, Time.at(1458518157) do
- @tar_writer.add_file 'x', 0644 do |f| f.write 'a' * 10 end
+ @tar_writer.add_file 'x', 0644 do |f|
+ f.write 'a' * 10
+ end
assert_headers_equal(tar_file_header('x', '', 0644, 10, Time.now),
@io.string[0, 512])
@@ -160,7 +162,9 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
def test_add_file_simple
Time.stub :now, Time.at(1458518157) do
- @tar_writer.add_file_simple 'x', 0644, 10 do |io| io.write "a" * 10 end
+ @tar_writer.add_file_simple 'x', 0644, 10 do |io|
+ io.write "a" * 10
+ end
assert_headers_equal(tar_file_header('x', '', 0644, 10, Time.now),
@io.string[0, 512])
@@ -173,7 +177,9 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
def test_add_file_simple_source_date_epoch
ENV["SOURCE_DATE_EPOCH"] = "123456789"
Time.stub :now, Time.at(1458518157) do
- @tar_writer.add_file_simple 'x', 0644, 10 do |io| io.write "a" * 10 end
+ @tar_writer.add_file_simple 'x', 0644, 10 do |io|
+ io.write "a" * 10
+ end
assert_headers_equal(tar_file_header('x', '', 0644, 10, Time.at(ENV["SOURCE_DATE_EPOCH"].to_i).utc),
@io.string[0, 512])
@@ -195,7 +201,7 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
@tar_writer.add_file_simple("lib/foo/bar", 0, 10) { |f| f.write @data }
@tar_writer.flush
- assert_equal @data + ("\0" * (512-@data.size)),
+ assert_equal @data + ("\0" * (512 - @data.size)),
@io.string[512, 512]
end
@@ -295,7 +301,7 @@ class TestGemPackageTarWriter < Gem::Package::TarTestCase
# note, GNU tar 1.28 is unable to handle this case too,
# tested with "tar --format=ustar -cPf /tmp/foo.tartar -- /aaaaaa....a"
- name = '/' + 'a' * 100
+ name = '/' + 'a' * 100
exception = assert_raises Gem::Package::TooLongFileName do
@tar_writer.split_name name
end
diff --git a/test/rubygems/test_gem_path_support.rb b/test/rubygems/test_gem_path_support.rb
index 551ec28781..1f9cfe2c57 100644
--- a/test/rubygems/test_gem_path_support.rb
+++ b/test/rubygems/test_gem_path_support.rb
@@ -4,6 +4,7 @@ require 'rubygems'
require 'fileutils'
class TestGemPathSupport < Gem::TestCase
+
def setup
super
@@ -135,4 +136,5 @@ class TestGemPathSupport < Gem::TestCase
assert_equal dir, ps.home
assert_equal [dir, not_existing], ps.path
end
+
end
diff --git a/test/rubygems/test_gem_platform.rb b/test/rubygems/test_gem_platform.rb
index fc8b7030fb..61d1966119 100644
--- a/test/rubygems/test_gem_platform.rb
+++ b/test/rubygems/test_gem_platform.rb
@@ -211,13 +211,13 @@ class TestGemPlatform < Gem::TestCase
assert((arm === Gem::Platform.local), 'arm === armv5')
assert((armv5 === Gem::Platform.local), 'armv5 === armv5')
refute((armv7 === Gem::Platform.local), 'armv7 === armv5')
- refute((Gem::Platform.local === arm), 'armv5 === arm')
+ refute((Gem::Platform.local === arm), 'armv5 === arm')
util_set_arch 'armv7-linux'
assert((arm === Gem::Platform.local), 'arm === armv7')
refute((armv5 === Gem::Platform.local), 'armv5 === armv7')
assert((armv7 === Gem::Platform.local), 'armv7 === armv7')
- refute((Gem::Platform.local === arm), 'armv7 === arm')
+ refute((Gem::Platform.local === arm), 'armv7 === arm')
end
def test_equals3_version
@@ -304,4 +304,5 @@ class TestGemPlatform < Gem::TestCase
def refute_local_match(name)
refute_match Gem::Platform.local, name
end
+
end
diff --git a/test/rubygems/test_gem_rdoc.rb b/test/rubygems/test_gem_rdoc.rb
index 073578527d..6184d4b457 100644
--- a/test/rubygems/test_gem_rdoc.rb
+++ b/test/rubygems/test_gem_rdoc.rb
@@ -4,8 +4,8 @@ require 'rubygems/test_case'
require 'rubygems/rdoc'
class TestGemRDoc < Gem::TestCase
+
Gem::RDoc.load_rdoc
- rdoc_4 = Gem::Requirement.new('> 3').satisfied_by?(Gem::RDoc.rdoc_version)
def setup
super
@@ -31,29 +31,8 @@ class TestGemRDoc < Gem::TestCase
Gem.configuration[:rdoc] = nil
end
- ##
- # RDoc 4 ships with its own Gem::RDoc which overrides this one which is
- # shipped for backwards compatibility.
-
- def rdoc_4?
- Gem::Requirement.new('>= 4.0.0.preview2').satisfied_by? \
- @hook.class.rdoc_version
- end
-
- def rdoc_3?
- Gem::Requirement.new('~> 3.0').satisfied_by? @hook.class.rdoc_version
- end
-
- def rdoc_3_8_or_better?
- Gem::Requirement.new('>= 3.8').satisfied_by? @hook.class.rdoc_version
- end
-
def test_initialize
- if rdoc_4?
- refute @hook.generate_rdoc
- else
- assert @hook.generate_rdoc
- end
+ refute @hook.generate_rdoc
assert @hook.generate_ri
rdoc = Gem::RDoc.new @a, false, false
@@ -75,67 +54,6 @@ class TestGemRDoc < Gem::TestCase
assert_empty args
end
- def test_document
- skip 'RDoc 3 required' unless rdoc_3?
-
- options = RDoc::Options.new
- options.files = []
-
- rdoc = @hook.new_rdoc
- @hook.instance_variable_set :@rdoc, rdoc
- @hook.instance_variable_set :@file_info, []
-
- @hook.document 'darkfish', options, @a.doc_dir('rdoc')
-
- assert @hook.rdoc_installed?
- end unless rdoc_4
-
- def test_generate
- skip 'RDoc 3 required' unless rdoc_3?
-
- FileUtils.mkdir_p @a.doc_dir
- FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')
-
- @hook.generate
-
- assert @hook.rdoc_installed?
- assert @hook.ri_installed?
-
- rdoc = @hook.instance_variable_get :@rdoc
-
- refute rdoc.options.hyperlink_all
- end unless rdoc_4
-
- def test_generate_configuration_rdoc_array
- skip 'RDoc 3 required' unless rdoc_3?
-
- Gem.configuration[:rdoc] = %w[-A]
-
- FileUtils.mkdir_p @a.doc_dir
- FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')
-
- @hook.generate
-
- rdoc = @hook.instance_variable_get :@rdoc
-
- assert rdoc.options.hyperlink_all
- end unless rdoc_4
-
- def test_generate_configuration_rdoc_string
- skip 'RDoc 3 required' unless rdoc_3?
-
- Gem.configuration[:rdoc] = '-A'
-
- FileUtils.mkdir_p @a.doc_dir
- FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')
-
- @hook.generate
-
- rdoc = @hook.instance_variable_get :@rdoc
-
- assert rdoc.options.hyperlink_all
- end unless rdoc_4
-
def test_generate_disabled
@hook.generate_rdoc = false
@hook.generate_ri = false
@@ -146,57 +64,6 @@ class TestGemRDoc < Gem::TestCase
refute @hook.ri_installed?
end
- def test_generate_force
- skip 'RDoc 3 required' unless rdoc_3?
-
- FileUtils.mkdir_p @a.doc_dir 'ri'
- FileUtils.mkdir_p @a.doc_dir 'rdoc'
- FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')
-
- @hook.force = true
-
- @hook.generate
-
- assert_path_exists File.join(@a.doc_dir('rdoc'), 'index.html')
- assert_path_exists File.join(@a.doc_dir('ri'), 'cache.ri')
- end unless rdoc_4
-
- def test_generate_no_overwrite
- skip 'RDoc 3 required' unless rdoc_3?
-
- FileUtils.mkdir_p @a.doc_dir 'ri'
- FileUtils.mkdir_p @a.doc_dir 'rdoc'
- FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')
-
- @hook.generate
-
- refute_path_exists File.join(@a.doc_dir('rdoc'), 'index.html')
- refute_path_exists File.join(@a.doc_dir('ri'), 'cache.ri')
- end unless rdoc_4
-
- def test_generate_legacy
- skip 'RDoc < 3.8 required' if rdoc_3_8_or_better?
-
- FileUtils.mkdir_p @a.doc_dir
- FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')
-
- @hook.generate_legacy
-
- assert @hook.rdoc_installed?
- assert @hook.ri_installed?
- end unless rdoc_4
-
- def test_legacy_rdoc
- skip 'RDoc < 3.8 required' if rdoc_3_8_or_better?
-
- FileUtils.mkdir_p @a.doc_dir
- FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')
-
- @hook.legacy_rdoc '--op', @a.doc_dir('rdoc')
-
- assert @hook.rdoc_installed?
- end unless rdoc_4
-
def test_new_rdoc
assert_kind_of RDoc::RDoc, @hook.new_rdoc
end
diff --git a/test/rubygems/test_gem_remote_fetcher.rb b/test/rubygems/test_gem_remote_fetcher.rb
index a725fe205c..a5ff929bd0 100644
--- a/test/rubygems/test_gem_remote_fetcher.rb
+++ b/test/rubygems/test_gem_remote_fetcher.rb
@@ -84,7 +84,7 @@ gems:
# Generated via:
# x = OpenSSL::PKey::DH.new(2048) # wait a while...
# x.to_s => pem
- TEST_KEY_DH2048 = OpenSSL::PKey::DH.new <<-_end_of_pem_
+ TEST_KEY_DH2048 = OpenSSL::PKey::DH.new <<-_end_of_pem_
-----BEGIN DH PARAMETERS-----
MIIBCAKCAQEA3Ze2EHSfYkZLUn557torAmjBgPsqzbodaRaGZtgK1gEU+9nNJaFV
G1JKhmGUiEDyIW7idsBpe4sX/Wqjnp48Lr8IeI/SlEzLdoGpf05iRYXC8Cm9o8aM
@@ -117,7 +117,10 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
FileUtils.mkdir @gems_dir
# TODO: why does the remote fetcher need it written to disk?
- @a1, @a1_gem = util_gem 'a', '1' do |s| s.executables << 'a_bin' end
+ @a1, @a1_gem = util_gem 'a', '1' do |s|
+ s.executables << 'a_bin'
+ end
+
@a1.loaded_from = File.join(@gemhome, 'specifications', @a1.full_name)
Gem::RemoteFetcher.fetcher = nil
@@ -786,7 +789,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
ssl_server = self.class.start_ssl_server({
:SSLVerifyClient =>
- OpenSSL::SSL::VERIFY_PEER|OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT})
+ OpenSSL::SSL::VERIFY_PEER | OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT})
temp_ca_cert = File.join(DIR, 'ca_cert.pem')
temp_client_cert = File.join(DIR, 'client.pem')
@@ -803,7 +806,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
ssl_server = self.class.start_ssl_server({
:SSLVerifyClient =>
- OpenSSL::SSL::VERIFY_PEER|OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT})
+ OpenSSL::SSL::VERIFY_PEER | OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT})
temp_ca_cert = File.join(DIR, 'ca_cert.pem')
temp_client_cert = File.join(DIR, 'invalid_client.pem')
@@ -895,11 +898,14 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
end
class NilLog < WEBrick::Log
+
def log(level, data) #Do nothing
end
+
end
class << self
+
attr_reader :normal_server, :proxy_server
attr_accessor :enable_zip, :enable_yaml
@@ -959,12 +965,12 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
:SSLVerifyClient => nil,
:SSLCertName => nil
}.merge(config))
- server.mount_proc("/yaml") { |req, res|
+ server.mount_proc("/yaml") do |req, res|
res.body = "--- true\n"
- }
- server.mount_proc("/insecure_redirect") { |req, res|
+ end
+ server.mount_proc("/insecure_redirect") do |req, res|
res.set_redirect(WEBrick::HTTPStatus::MovedPermanently, req.query['to'])
- }
+ end
server.ssl_context.tmp_dh_callback = proc { TEST_KEY_DH2048 }
t = Thread.new do
begin
@@ -999,7 +1005,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
:AccessLog => null_logger
)
s.mount_proc("/kill") { |req, res| s.shutdown }
- s.mount_proc("/yaml") { |req, res|
+ s.mount_proc("/yaml") do |req, res|
if req["X-Captain"]
res.body = req["X-Captain"]
elsif @enable_yaml
@@ -1011,8 +1017,8 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
res.body = "<h1>NOT FOUND</h1>"
res['Content-Type'] = 'text/html'
end
- }
- s.mount_proc("/yaml.Z") { |req, res|
+ end
+ s.mount_proc("/yaml.Z") do |req, res|
if @enable_zip
res.body = Zlib::Deflate.deflate(data)
res['Content-Type'] = 'text/plain'
@@ -1021,7 +1027,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
res.body = "<h1>NOT FOUND</h1>"
res['Content-Type'] = 'text/html'
end
- }
+ end
th = Thread.new do
begin
s.start
@@ -1042,6 +1048,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
def key(filename)
OpenSSL::PKey::RSA.new(File.read(File.join(DIR, filename)))
end
+
end
def test_correct_for_windows_path
diff --git a/test/rubygems/test_gem_request.rb b/test/rubygems/test_gem_request.rb
index 0577eb6f99..5f7d7bb7be 100644
--- a/test/rubygems/test_gem_request.rb
+++ b/test/rubygems/test_gem_request.rb
@@ -93,11 +93,11 @@ class TestGemRequest < Gem::TestCase
def test_configure_connection_for_https
connection = Net::HTTP.new 'localhost', 443
- request = Class.new(Gem::Request) {
+ request = Class.new(Gem::Request) do
def self.get_cert_files
[TestGemRequest::PUBLIC_CERT_FILE]
end
- }.create_with_proxy URI('https://example'), nil, nil, nil
+ end.create_with_proxy URI('https://example'), nil, nil, nil
Gem::Request.configure_connection_for_https connection, request.cert_files
@@ -112,11 +112,11 @@ class TestGemRequest < Gem::TestCase
connection = Net::HTTP.new 'localhost', 443
- request = Class.new(Gem::Request) {
+ request = Class.new(Gem::Request) do
def self.get_cert_files
[TestGemRequest::PUBLIC_CERT_FILE]
end
- }.create_with_proxy URI('https://example'), nil, nil, nil
+ end.create_with_proxy URI('https://example'), nil, nil, nil
Gem::Request.configure_connection_for_https connection, request.cert_files
@@ -486,6 +486,7 @@ ERROR: Certificate is an invalid CA certificate
end
class Conn
+
attr_accessor :payload
def new(*args); self; end
@@ -504,6 +505,7 @@ ERROR: Certificate is an invalid CA certificate
self.payload = req
@response
end
+
end
end if defined?(OpenSSL::SSL)
diff --git a/test/rubygems/test_gem_request_connection_pools.rb b/test/rubygems/test_gem_request_connection_pools.rb
index eb48ba45d2..f8d2095167 100644
--- a/test/rubygems/test_gem_request_connection_pools.rb
+++ b/test/rubygems/test_gem_request_connection_pools.rb
@@ -4,12 +4,15 @@ require 'rubygems/request'
require 'timeout'
class TestGemRequestConnectionPool < Gem::TestCase
+
class FakeHttp
+
def initialize(*args)
end
def start
end
+
end
def setup
@@ -139,12 +142,13 @@ class TestGemRequestConnectionPool < Gem::TestCase
pool.checkout
- Thread.new {
+ Thread.new do
assert_raises(Timeout::Error) do
Timeout.timeout(1) do
pool.checkout
end
end
- }.join
+ end.join
end
+
end
diff --git a/test/rubygems/test_gem_request_set.rb b/test/rubygems/test_gem_request_set.rb
index 86986f2287..ac344015e7 100644
--- a/test/rubygems/test_gem_request_set.rb
+++ b/test/rubygems/test_gem_request_set.rb
@@ -3,6 +3,7 @@ require 'rubygems/test_case'
require 'rubygems/request_set'
class TestGemRequestSet < Gem::TestCase
+
def setup
super
@@ -311,8 +312,14 @@ ruby "0"
end
def test_resolve_development_shallow
- a = util_spec 'a', 1 do |s| s.add_development_dependency 'b' end
- b = util_spec 'b', 1 do |s| s.add_development_dependency 'c' end
+ a = util_spec 'a', 1 do |s|
+ s.add_development_dependency 'b'
+ end
+
+ b = util_spec 'b', 1 do |s|
+ s.add_development_dependency 'c'
+ end
+
c = util_spec 'c', 1
a_spec = Gem::Resolver::SpecSpecification.new nil, a
@@ -528,8 +535,14 @@ ruby "0"
end
def test_sorted_requests_development_shallow
- a = util_spec 'a', 1 do |s| s.add_development_dependency 'b' end
- b = util_spec 'b', 1 do |s| s.add_development_dependency 'c' end
+ a = util_spec 'a', 1 do |s|
+ s.add_development_dependency 'b'
+ end
+
+ b = util_spec 'b', 1 do |s|
+ s.add_development_dependency 'c'
+ end
+
c = util_spec 'c', 1
rs = Gem::RequestSet.new
@@ -547,8 +560,14 @@ ruby "0"
end
def test_tsort_each_child_development
- a = util_spec 'a', 1 do |s| s.add_development_dependency 'b' end
- b = util_spec 'b', 1 do |s| s.add_development_dependency 'c' end
+ a = util_spec 'a', 1 do |s|
+ s.add_development_dependency 'b'
+ end
+
+ b = util_spec 'b', 1 do |s|
+ s.add_development_dependency 'c'
+ end
+
c = util_spec 'c', 1
rs = Gem::RequestSet.new
@@ -570,8 +589,14 @@ ruby "0"
end
def test_tsort_each_child_development_shallow
- a = util_spec 'a', 1 do |s| s.add_development_dependency 'b' end
- b = util_spec 'b', 1 do |s| s.add_development_dependency 'c' end
+ a = util_spec 'a', 1 do |s|
+ s.add_development_dependency 'b'
+ end
+
+ b = util_spec 'b', 1 do |s|
+ s.add_development_dependency 'c'
+ end
+
c = util_spec 'c', 1
rs = Gem::RequestSet.new
diff --git a/test/rubygems/test_gem_request_set_gem_dependency_api.rb b/test/rubygems/test_gem_request_set_gem_dependency_api.rb
index 0e597f2b11..0df0bef215 100644
--- a/test/rubygems/test_gem_request_set_gem_dependency_api.rb
+++ b/test/rubygems/test_gem_request_set_gem_dependency_api.rb
@@ -283,6 +283,14 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
refute_empty set.dependencies
end
+ with_engine_version 'truffleruby', '2.0.0' do
+ set = Gem::RequestSet.new
+ gda = @GDA.new set, 'gem.deps.rb'
+ gda.gem 'a', :platforms => :ruby
+
+ refute_empty set.dependencies
+ end
+
with_engine_version 'jruby', '1.7.6' do
set = Gem::RequestSet.new
gda = @GDA.new set, 'gem.deps.rb'
@@ -310,6 +318,12 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
assert_empty @set.dependencies
end
+
+ with_engine_version 'truffleruby', '1.2.3' do
+ @gda.gem 'a', :platforms => :mri
+
+ assert_empty @set.dependencies
+ end
end
def test_gem_platforms_maglev
@@ -332,6 +346,22 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
Gem.win_platform = win_platform
end
+ def test_gem_platforms_truffleruby
+ with_engine_version 'truffleruby', '1.0.0' do
+ set = Gem::RequestSet.new
+ gda = @GDA.new set, 'gem.deps.rb'
+ gda.gem 'a', :platforms => :truffleruby
+
+ refute_empty set.dependencies
+
+ set = Gem::RequestSet.new
+ gda = @GDA.new set, 'gem.deps.rb'
+ gda.gem 'a', :platforms => :maglev
+
+ assert_empty set.dependencies
+ end
+ end
+
def test_gem_platforms_multiple
win_platform, Gem.win_platform = Gem.win_platform?, false
@@ -738,6 +768,12 @@ end
:engine => 'jruby', :engine_version => '1.7.6'
end
+
+ with_engine_version 'truffleruby', '1.0.0-rc11' do
+ assert @gda.ruby RUBY_VERSION,
+ :engine => 'truffleruby', :engine_version => '1.0.0-rc11'
+
+ end
end
def test_ruby_engine_mismatch_engine
diff --git a/test/rubygems/test_gem_request_set_lockfile.rb b/test/rubygems/test_gem_request_set_lockfile.rb
index 9ac691ebdd..7c5e256a2d 100644
--- a/test/rubygems/test_gem_request_set_lockfile.rb
+++ b/test/rubygems/test_gem_request_set_lockfile.rb
@@ -466,4 +466,5 @@ DEPENDENCIES
assert_equal 'hello', File.read(gem_deps_lock_file)
end
+
end
diff --git a/test/rubygems/test_gem_request_set_lockfile_parser.rb b/test/rubygems/test_gem_request_set_lockfile_parser.rb
index 27ee519ea7..c07a8c2a3d 100644
--- a/test/rubygems/test_gem_request_set_lockfile_parser.rb
+++ b/test/rubygems/test_gem_request_set_lockfile_parser.rb
@@ -6,6 +6,7 @@ require 'rubygems/request_set/lockfile/tokenizer'
require 'rubygems/request_set/lockfile/parser'
class TestGemRequestSetLockfileParser < Gem::TestCase
+
def setup
super
@gem_deps_file = 'gem.deps.rb'
@@ -541,4 +542,5 @@ DEPENDENCIES
parser = tokenizer.make_parser set, platforms
parser.parse
end
+
end
diff --git a/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb b/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb
index 48e66cf56a..aa91fc4468 100644
--- a/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb
+++ b/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb
@@ -6,6 +6,7 @@ require 'rubygems/request_set/lockfile/tokenizer'
require 'rubygems/request_set/lockfile/parser'
class TestGemRequestSetLockfileTokenizer < Gem::TestCase
+
def setup
super
@@ -303,4 +304,5 @@ GEM
def tokenize_lockfile
Gem::RequestSet::Lockfile::Tokenizer.from_file(@lock_file).to_a
end
+
end
diff --git a/test/rubygems/test_gem_requirement.rb b/test/rubygems/test_gem_requirement.rb
index 7a59243b6a..96acb24703 100644
--- a/test/rubygems/test_gem_requirement.rb
+++ b/test/rubygems/test_gem_requirement.rb
@@ -416,4 +416,5 @@ class TestGemRequirement < Gem::TestCase
refute req(requirement).satisfied_by?(v(version)),
"#{requirement} is not satisfied by #{version}"
end
+
end
diff --git a/test/rubygems/test_gem_resolver.rb b/test/rubygems/test_gem_resolver.rb
index fa1c595afd..74dc647a17 100644
--- a/test/rubygems/test_gem_resolver.rb
+++ b/test/rubygems/test_gem_resolver.rb
@@ -71,7 +71,7 @@ class TestGemResolver < Gem::TestCase
end
def test_self_compose_sets_nil
- index_set = @DR::IndexSet.new
+ index_set = @DR::IndexSet.new
composed = @DR.compose_sets index_set, nil
@@ -85,7 +85,7 @@ class TestGemResolver < Gem::TestCase
end
def test_self_compose_sets_single
- index_set = @DR::IndexSet.new
+ index_set = @DR::IndexSet.new
composed = @DR.compose_sets index_set
@@ -151,16 +151,31 @@ class TestGemResolver < Gem::TestCase
def test_resolve_conservative
a1_spec = util_spec 'a', 1
+
a2_spec = util_spec 'a', 2 do |s|
s.add_dependency 'b', 2
s.add_dependency 'c'
end
+
b1_spec = util_spec 'b', 1
b2_spec = util_spec 'b', 2
- c1_spec = util_spec 'c', 1 do |s| s.add_dependency 'd', 2 end
- c2_spec = util_spec 'c', 2 do |s| s.add_dependency 'd', 2 end
- d1_spec = util_spec 'd', 1 do |s| s.add_dependency 'e' end
- d2_spec = util_spec 'd', 2 do |s| s.add_dependency 'e' end
+
+ c1_spec = util_spec 'c', 1 do |s|
+ s.add_dependency 'd', 2
+ end
+
+ c2_spec = util_spec 'c', 2 do |s|
+ s.add_dependency 'd', 2
+ end
+
+ d1_spec = util_spec 'd', 1 do |s|
+ s.add_dependency 'e'
+ end
+
+ d2_spec = util_spec 'd', 2 do |s|
+ s.add_dependency 'e'
+ end
+
e1_spec = util_spec 'e', 1
e2_spec = util_spec 'e', 2
@@ -177,7 +192,7 @@ class TestGemResolver < Gem::TestCase
# With the following gems already installed:
# a-1, b-1, c-1, e-1
- res.skip_gems = {'a'=>[a1_spec], 'b'=>[b1_spec], 'c'=>[c1_spec], 'e'=>[e1_spec]}
+ res.skip_gems = {'a' => [a1_spec], 'b' => [b1_spec], 'c' => [c1_spec], 'e' => [e1_spec]}
# Make sure the following gems end up getting used/installed/upgraded:
# a-2 (upgraded)
@@ -189,8 +204,14 @@ class TestGemResolver < Gem::TestCase
end
def test_resolve_development
- a_spec = util_spec 'a', 1 do |s| s.add_development_dependency 'b' end
- b_spec = util_spec 'b', 1 do |s| s.add_development_dependency 'c' end
+ a_spec = util_spec 'a', 1 do |s|
+ s.add_development_dependency 'b'
+ end
+
+ b_spec = util_spec 'b', 1 do
+ |s| s.add_development_dependency 'c'
+ end
+
c_spec = util_spec 'c', 1
a_dep = make_dep 'a', '= 1'
@@ -212,10 +233,16 @@ class TestGemResolver < Gem::TestCase
s.add_runtime_dependency 'd'
end
- b_spec = util_spec 'b', 1 do |s| s.add_development_dependency 'c' end
+ b_spec = util_spec 'b', 1 do |s|
+ s.add_development_dependency 'c'
+ end
+
c_spec = util_spec 'c', 1
- d_spec = util_spec 'd', 1 do |s| s.add_development_dependency 'e' end
+ d_spec = util_spec 'd', 1 do |s|
+ s.add_development_dependency 'e'
+ end
+
e_spec = util_spec 'e', 1
a_dep = make_dep 'a', '= 1'
@@ -300,8 +327,14 @@ class TestGemResolver < Gem::TestCase
spec_fetcher do |fetcher|
fetcher.spec 'a', 2
- a2_p1 = fetcher.spec 'a', 2 do |s| s.platform = Gem::Platform.local end
- a3_p2 = fetcher.spec 'a', 3 do |s| s.platform = unknown end
+
+ a2_p1 = fetcher.spec 'a', 2 do |s|
+ s.platform = Gem::Platform.local
+ end
+
+ a3_p2 = fetcher.spec 'a', 3 do |s|
+ s.platform = unknown
+ end
end
v2 = v(2)
@@ -709,8 +742,14 @@ class TestGemResolver < Gem::TestCase
r = Gem::Resolver.new nil, nil
a1 = util_spec 'a', 1
- a1_p1 = util_spec 'a', 1 do |s| s.platform = Gem::Platform.local end
- a1_p2 = util_spec 'a', 1 do |s| s.platform = 'unknown' end
+
+ a1_p1 = util_spec 'a', 1 do |s|
+ s.platform = Gem::Platform.local
+ end
+
+ a1_p2 = util_spec 'a', 1 do |s|
+ s.platform = 'unknown'
+ end
selected = r.select_local_platforms [a1, a1_p1, a1_p2]
@@ -719,8 +758,14 @@ class TestGemResolver < Gem::TestCase
def test_search_for_local_platform_partial_string_match
a1 = util_spec 'a', 1
- a1_p1 = util_spec 'a', 1 do |s| s.platform = Gem::Platform.local.os end
- a1_p2 = util_spec 'a', 1 do |s| s.platform = 'unknown' end
+
+ a1_p1 = util_spec 'a', 1 do |s|
+ s.platform = Gem::Platform.local.os
+ end
+
+ a1_p2 = util_spec 'a', 1 do |s|
+ s.platform = 'unknown'
+ end
s = set(a1_p1, a1_p2, a1)
d = [make_dep('a')]
diff --git a/test/rubygems/test_gem_resolver_index_specification.rb b/test/rubygems/test_gem_resolver_index_specification.rb
index 3768dd9bae..43e8efd8b6 100644
--- a/test/rubygems/test_gem_resolver_index_specification.rb
+++ b/test/rubygems/test_gem_resolver_index_specification.rb
@@ -55,7 +55,9 @@ class TestGemResolverIndexSpecification < Gem::TestCase
def test_spec
specs = spec_fetcher do |fetcher|
fetcher.spec 'a', 2
- fetcher.spec 'a', 2 do |s| s.platform = Gem::Platform.local end
+ fetcher.spec 'a', 2 do |s|
+ s.platform = Gem::Platform.local
+ end
end
source = Gem::Source.new @gem_repo
@@ -71,7 +73,10 @@ class TestGemResolverIndexSpecification < Gem::TestCase
end
def test_spec_local
- a_2_p = util_spec 'a', 2 do |s| s.platform = Gem::Platform.local end
+ a_2_p = util_spec 'a', 2 do |s|
+ s.platform = Gem::Platform.local
+ end
+
Gem::Package.build a_2_p
source = Gem::Source::Local.new
diff --git a/test/rubygems/test_gem_resolver_installer_set.rb b/test/rubygems/test_gem_resolver_installer_set.rb
index 50350e2d3d..5138743cdf 100644
--- a/test/rubygems/test_gem_resolver_installer_set.rb
+++ b/test/rubygems/test_gem_resolver_installer_set.rb
@@ -173,7 +173,9 @@ class TestGemResolverInstallerSet < Gem::TestCase
def test_load_spec
specs = spec_fetcher do |fetcher|
fetcher.spec 'a', 2
- fetcher.spec 'a', 2 do |s| s.platform = Gem::Platform.local end
+ fetcher.spec 'a', 2 do |s|
+ s.platform = Gem::Platform.local
+ end
end
source = Gem::Source.new @gem_repo
diff --git a/test/rubygems/test_gem_resolver_specification.rb b/test/rubygems/test_gem_resolver_specification.rb
index c184cea352..e663ff1837 100644
--- a/test/rubygems/test_gem_resolver_specification.rb
+++ b/test/rubygems/test_gem_resolver_specification.rb
@@ -4,6 +4,7 @@ require 'rubygems/test_case'
class TestGemResolverSpecification < Gem::TestCase
class TestSpec < Gem::Resolver::Specification
+
attr_writer :source
attr_reader :spec
@@ -12,6 +13,7 @@ class TestGemResolverSpecification < Gem::TestCase
@spec = spec
end
+
end
def test_install
diff --git a/test/rubygems/test_gem_security.rb b/test/rubygems/test_gem_security.rb
index b5a887abb8..1ba3fa7d9c 100644
--- a/test/rubygems/test_gem_security.rb
+++ b/test/rubygems/test_gem_security.rb
@@ -280,7 +280,7 @@ class TestGemSecurity < Gem::TestCase
assert_path_exists path
- key_from_file = OpenSSL::PKey::RSA.new File.read(path), passphrase
+ key_from_file = OpenSSL::PKey::RSA.new File.read(path), passphrase
assert_equal key.to_pem, key_from_file.to_pem
end
diff --git a/test/rubygems/test_gem_server.rb b/test/rubygems/test_gem_server.rb
index 8a3e6410ae..31ae344784 100644
--- a/test/rubygems/test_gem_server.rb
+++ b/test/rubygems/test_gem_server.rb
@@ -4,10 +4,13 @@ require 'rubygems/server'
require 'stringio'
class Gem::Server
+
attr_reader :server
+
end
class TestGemServer < Gem::TestCase
+
def process_based_port
0
end
@@ -242,7 +245,9 @@ class TestGemServer < Gem::TestCase
end
def test_quick_marshal_a_1_mswin32_gemspec_rz
- quick_gem 'a', '1' do |s| s.platform = Gem::Platform.local end
+ quick_gem 'a', '1' do |s|
+ s.platform = Gem::Platform.local
+ end
data = StringIO.new "GET /quick/Marshal.#{Gem.marshal_version}/a-1-#{Gem::Platform.local}.gemspec.rz HTTP/1.0\r\n\r\n"
@req.parse data
@@ -604,4 +609,5 @@ class TestGemServer < Gem::TestCase
@server.instance_variable_set :@server, webrick
end
+
end
diff --git a/test/rubygems/test_gem_silent_ui.rb b/test/rubygems/test_gem_silent_ui.rb
index 497e2c0eb1..d49166ff6f 100644
--- a/test/rubygems/test_gem_silent_ui.rb
+++ b/test/rubygems/test_gem_silent_ui.rb
@@ -114,4 +114,5 @@ class TestGemSilentUI < Gem::TestCase
assert_empty out, 'No output'
assert_empty err, 'No output'
end
+
end
diff --git a/test/rubygems/test_gem_source.rb b/test/rubygems/test_gem_source.rb
index f8cd031c72..2ed9fc78e7 100644
--- a/test/rubygems/test_gem_source.rb
+++ b/test/rubygems/test_gem_source.rb
@@ -199,16 +199,16 @@ class TestGemSource < Gem::TestCase
installed = Gem::Source::Installed.new
local = Gem::Source::Local.new
- assert_equal( 0, remote. <=>(remote), 'remote <=> remote')
+ assert_equal(0, remote. <=>(remote), 'remote <=> remote')
assert_equal(-1, remote. <=>(specific), 'remote <=> specific')
- assert_equal( 1, specific. <=>(remote), 'specific <=> remote')
+ assert_equal(1, specific. <=>(remote), 'specific <=> remote')
assert_equal(-1, remote. <=>(local), 'remote <=> local')
- assert_equal( 1, local. <=>(remote), 'local <=> remote')
+ assert_equal(1, local. <=>(remote), 'local <=> remote')
assert_equal(-1, remote. <=>(installed), 'remote <=> installed')
- assert_equal( 1, installed.<=>(remote), 'installed <=> remote')
+ assert_equal(1, installed.<=>(remote), 'installed <=> remote')
no_uri = @source.dup
no_uri.instance_variable_set :@uri, nil
@@ -220,9 +220,9 @@ class TestGemSource < Gem::TestCase
sourceA = Gem::Source.new "http://example.com/a"
sourceB = Gem::Source.new "http://example.com/b"
- assert_equal( 0, sourceA. <=>(sourceA), 'sourceA <=> sourceA')
- assert_equal( 1, sourceA. <=>(sourceB), 'sourceA <=> sourceB')
- assert_equal( 1, sourceB. <=>(sourceA), 'sourceB <=> sourceA')
+ assert_equal(0, sourceA. <=>(sourceA), 'sourceA <=> sourceA')
+ assert_equal(1, sourceA. <=>(sourceB), 'sourceA <=> sourceB')
+ assert_equal(1, sourceB. <=>(sourceA), 'sourceB <=> sourceA')
end
def test_update_cache_eh
diff --git a/test/rubygems/test_gem_source_fetch_problem.rb b/test/rubygems/test_gem_source_fetch_problem.rb
index f3b57e8384..65b182890a 100644
--- a/test/rubygems/test_gem_source_fetch_problem.rb
+++ b/test/rubygems/test_gem_source_fetch_problem.rb
@@ -24,4 +24,5 @@ class TestGemSourceFetchProblem < Gem::TestCase
refute_match sf.wordy, 'secret'
end
+
end
diff --git a/test/rubygems/test_gem_source_git.rb b/test/rubygems/test_gem_source_git.rb
index 586e71bae6..2dafcacc8e 100644
--- a/test/rubygems/test_gem_source_git.rb
+++ b/test/rubygems/test_gem_source_git.rb
@@ -208,16 +208,16 @@ class TestGemSourceGit < Gem::TestCase
installed = Gem::Source::Installed.new
vendor = Gem::Source::Vendor.new 'vendor/foo'
- assert_equal( 0, git. <=>(git), 'git <=> git')
+ assert_equal(0, git. <=>(git), 'git <=> git')
- assert_equal( 1, git. <=>(remote), 'git <=> remote')
+ assert_equal(1, git. <=>(remote), 'git <=> remote')
assert_equal(-1, remote. <=>(git), 'remote <=> git')
- assert_equal( 1, git. <=>(installed), 'git <=> installed')
+ assert_equal(1, git. <=>(installed), 'git <=> installed')
assert_equal(-1, installed.<=>(git), 'installed <=> git')
assert_equal(-1, git. <=>(vendor), 'git <=> vendor')
- assert_equal( 1, vendor. <=>(git), 'vendor <=> git')
+ assert_equal(1, vendor. <=>(git), 'vendor <=> git')
end
def test_specs
diff --git a/test/rubygems/test_gem_source_installed.rb b/test/rubygems/test_gem_source_installed.rb
index b469f842fc..b4a75d8d4f 100644
--- a/test/rubygems/test_gem_source_installed.rb
+++ b/test/rubygems/test_gem_source_installed.rb
@@ -15,21 +15,21 @@ class TestGemSourceInstalled < Gem::TestCase
git = Gem::Source::Git.new 'a', 'a', 'master'
vendor = Gem::Source::Vendor.new 'a'
- assert_equal( 0, installed.<=>(installed), 'installed <=> installed')
+ assert_equal(0, installed.<=>(installed), 'installed <=> installed')
assert_equal(-1, remote. <=>(installed), 'remote <=> installed')
- assert_equal( 1, installed.<=>(remote), 'installed <=> remote')
+ assert_equal(1, installed.<=>(remote), 'installed <=> remote')
- assert_equal( 1, installed.<=>(local), 'installed <=> local')
+ assert_equal(1, installed.<=>(local), 'installed <=> local')
assert_equal(-1, local. <=>(installed), 'local <=> installed')
assert_equal(-1, specific. <=>(installed), 'specific <=> installed')
- assert_equal( 1, installed.<=>(specific), 'installed <=> specific')
+ assert_equal(1, installed.<=>(specific), 'installed <=> specific')
- assert_equal( 1, git. <=>(installed), 'git <=> installed')
+ assert_equal(1, git. <=>(installed), 'git <=> installed')
assert_equal(-1, installed.<=>(git), 'installed <=> git')
- assert_equal( 1, vendor. <=>(installed), 'vendor <=> installed')
+ assert_equal(1, vendor. <=>(installed), 'vendor <=> installed')
assert_equal(-1, installed.<=>(vendor), 'installed <=> vendor')
end
diff --git a/test/rubygems/test_gem_source_list.rb b/test/rubygems/test_gem_source_list.rb
index c93e0a8697..b05703f0ba 100644
--- a/test/rubygems/test_gem_source_list.rb
+++ b/test/rubygems/test_gem_source_list.rb
@@ -3,6 +3,7 @@ require 'rubygems/source_list'
require 'rubygems/test_case'
class TestGemSourceList < Gem::TestCase
+
def setup
super
diff --git a/test/rubygems/test_gem_source_local.rb b/test/rubygems/test_gem_source_local.rb
index 7a42cbc76f..2f796f0ed7 100644
--- a/test/rubygems/test_gem_source_local.rb
+++ b/test/rubygems/test_gem_source_local.rb
@@ -5,6 +5,7 @@ require 'rubygems/source'
require 'fileutils'
class TestGemSourceLocal < Gem::TestCase
+
def setup
super
@@ -92,16 +93,16 @@ class TestGemSourceLocal < Gem::TestCase
installed = Gem::Source::Installed.new
local = Gem::Source::Local.new
- assert_equal( 0, local. <=>(local), 'local <=> local')
+ assert_equal(0, local. <=>(local), 'local <=> local')
assert_equal(-1, remote. <=>(local), 'remote <=> local')
- assert_equal( 1, local. <=>(remote), 'local <=> remote')
+ assert_equal(1, local. <=>(remote), 'local <=> remote')
- assert_equal( 1, installed.<=>(local), 'installed <=> local')
+ assert_equal(1, installed.<=>(local), 'installed <=> local')
assert_equal(-1, local. <=>(installed), 'local <=> installed')
assert_equal(-1, specific. <=>(local), 'specific <=> local')
- assert_equal( 1, local. <=>(specific), 'local <=> specific')
+ assert_equal(1, local. <=>(specific), 'local <=> specific')
end
end
diff --git a/test/rubygems/test_gem_source_lock.rb b/test/rubygems/test_gem_source_lock.rb
index 6edfb00e1a..953941b01a 100644
--- a/test/rubygems/test_gem_source_lock.rb
+++ b/test/rubygems/test_gem_source_lock.rb
@@ -40,25 +40,25 @@ class TestGemSourceLock < Gem::TestCase
vendor = Gem::Source::Vendor.new 'vendor/a'
v_lock = Gem::Source::Lock.new vendor
- assert_equal( 0, g_lock.<=>(g_lock), 'g_lock <=> g_lock')
- assert_equal( 0, i_lock.<=>(i_lock), 'i_lock <=> i_lock')
- assert_equal( 0, v_lock.<=>(v_lock), 'v_lock <=> v_lock')
+ assert_equal(0, g_lock.<=>(g_lock), 'g_lock <=> g_lock')
+ assert_equal(0, i_lock.<=>(i_lock), 'i_lock <=> i_lock')
+ assert_equal(0, v_lock.<=>(v_lock), 'v_lock <=> v_lock')
- assert_equal( 1, g_lock.<=>(i_lock), 'g_lock <=> i_lock')
+ assert_equal(1, g_lock.<=>(i_lock), 'g_lock <=> i_lock')
assert_equal(-1, i_lock.<=>(g_lock), 'i_lock <=> g_lock')
assert_equal(-1, g_lock.<=>(v_lock), 'g_lock <=> v_lock')
- assert_equal( 1, v_lock.<=>(g_lock), 'v_lock <=> g_lock')
+ assert_equal(1, v_lock.<=>(g_lock), 'v_lock <=> g_lock')
assert_equal(-1, i_lock.<=>(v_lock), 'i_lock <=> v_lock')
- assert_equal( 1, v_lock.<=>(i_lock), 'i_lock <=> v_lock')
+ assert_equal(1, v_lock.<=>(i_lock), 'i_lock <=> v_lock')
end
def test_spaceship_git
git = Gem::Source::Git.new 'a', 'git/a', 'master', false
lock = Gem::Source::Lock.new git
- assert_equal( 1, lock.<=>(git), 'lock <=> git')
+ assert_equal(1, lock.<=>(git), 'lock <=> git')
assert_equal(-1, git .<=>(lock), 'git <=> lock')
end
@@ -66,7 +66,7 @@ class TestGemSourceLock < Gem::TestCase
installed = Gem::Source::Installed.new
lock = Gem::Source::Lock.new installed
- assert_equal( 1, lock. <=>(installed), 'lock <=> installed')
+ assert_equal(1, lock. <=>(installed), 'lock <=> installed')
assert_equal(-1, installed.<=>(lock), 'installed <=> lock')
end
@@ -74,7 +74,7 @@ class TestGemSourceLock < Gem::TestCase
local = Gem::Source::Local.new
lock = Gem::Source::Lock.new local # nonsense
- assert_equal( 1, lock. <=>(local), 'lock <=> local')
+ assert_equal(1, lock. <=>(local), 'lock <=> local')
assert_equal(-1, local.<=>(lock), 'local <=> lock')
end
@@ -82,7 +82,7 @@ class TestGemSourceLock < Gem::TestCase
remote = Gem::Source.new @gem_repo
lock = Gem::Source::Lock.new remote
- assert_equal( 1, lock. <=>(remote), 'lock <=> remote')
+ assert_equal(1, lock. <=>(remote), 'lock <=> remote')
assert_equal(-1, remote.<=>(lock), 'remote <=> lock')
end
@@ -92,7 +92,7 @@ class TestGemSourceLock < Gem::TestCase
specific = Gem::Source::SpecificFile.new gem
lock = Gem::Source::Lock.new specific # nonsense
- assert_equal( 1, lock .<=>(specific), 'lock <=> specific')
+ assert_equal(1, lock .<=>(specific), 'lock <=> specific')
assert_equal(-1, specific.<=>(lock), 'specific <=> lock')
end
@@ -100,7 +100,7 @@ class TestGemSourceLock < Gem::TestCase
vendor = Gem::Source::Vendor.new 'vendor/a'
lock = Gem::Source::Lock.new vendor
- assert_equal( 1, lock. <=>(vendor), 'lock <=> vendor')
+ assert_equal(1, lock. <=>(vendor), 'lock <=> vendor')
assert_equal(-1, vendor.<=>(lock), 'vendor <=> lock')
end
diff --git a/test/rubygems/test_gem_source_specific_file.rb b/test/rubygems/test_gem_source_specific_file.rb
index 5199f0d1b0..9e4ebaa9c3 100644
--- a/test/rubygems/test_gem_source_specific_file.rb
+++ b/test/rubygems/test_gem_source_specific_file.rb
@@ -3,6 +3,7 @@ require 'rubygems/test_case'
require 'rubygems/source'
class TestGemSourceSpecificFile < Gem::TestCase
+
def setup
super
@@ -45,16 +46,16 @@ class TestGemSourceSpecificFile < Gem::TestCase
installed = Gem::Source::Installed.new
local = Gem::Source::Local.new
- assert_equal( 0, specific. <=>(specific), 'specific <=> specific')
+ assert_equal(0, specific. <=>(specific), 'specific <=> specific')
assert_equal(-1, remote. <=>(specific), 'remote <=> specific')
- assert_equal( 1, specific. <=>(remote), 'specific <=> remote')
+ assert_equal(1, specific. <=>(remote), 'specific <=> remote')
assert_equal(-1, specific. <=>(local), 'specific <=> local')
- assert_equal( 1, local. <=>(specific), 'local <=> specific')
+ assert_equal(1, local. <=>(specific), 'local <=> specific')
assert_equal(-1, specific. <=>(installed), 'specific <=> installed')
- assert_equal( 1, installed.<=>(specific), 'installed <=> specific')
+ assert_equal(1, installed.<=>(specific), 'installed <=> specific')
a2 = quick_gem 'a', '2'
util_build_gem a2
@@ -69,8 +70,8 @@ class TestGemSourceSpecificFile < Gem::TestCase
assert_nil a1_source.<=>(b1_source), 'a1_source <=> b1_source'
assert_equal(-1, a1_source.<=>(a2_source), 'a1_source <=> a2_source')
- assert_equal( 0, a1_source.<=>(a1_source), 'a1_source <=> a1_source')
- assert_equal( 1, a2_source.<=>(a1_source), 'a2_source <=> a1_source')
+ assert_equal(0, a1_source.<=>(a1_source), 'a1_source <=> a1_source')
+ assert_equal(1, a2_source.<=>(a1_source), 'a2_source <=> a1_source')
end
end
diff --git a/test/rubygems/test_gem_source_vendor.rb b/test/rubygems/test_gem_source_vendor.rb
index 3082bb7e68..fafe1a1907 100644
--- a/test/rubygems/test_gem_source_vendor.rb
+++ b/test/rubygems/test_gem_source_vendor.rb
@@ -16,15 +16,15 @@ class TestGemSourceVendor < Gem::TestCase
git = Gem::Source::Git.new 'a', 'a', 'master'
installed = Gem::Source::Installed.new
- assert_equal( 0, vendor. <=>(vendor), 'vendor <=> vendor')
+ assert_equal(0, vendor. <=>(vendor), 'vendor <=> vendor')
- assert_equal( 1, vendor. <=>(remote), 'vendor <=> remote')
+ assert_equal(1, vendor. <=>(remote), 'vendor <=> remote')
assert_equal(-1, remote. <=>(vendor), 'remote <=> vendor')
- assert_equal( 1, vendor. <=>(git), 'vendor <=> git')
+ assert_equal(1, vendor. <=>(git), 'vendor <=> git')
assert_equal(-1, git. <=>(vendor), 'git <=> vendor')
- assert_equal( 1, vendor. <=>(installed), 'vendor <=> installed')
+ assert_equal(1, vendor. <=>(installed), 'vendor <=> installed')
assert_equal(-1, installed.<=>(vendor), 'installed <=> vendor')
end
diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb
index 797e34cd92..75b8b8ed1f 100644
--- a/test/rubygems/test_gem_specification.rb
+++ b/test/rubygems/test_gem_specification.rb
@@ -143,9 +143,9 @@ end
num_of_version_per_pkg = 3
packages = (0..num_of_pkg).map do |pkgi|
(0..num_of_version_per_pkg).map do |pkg_version|
- deps = Hash[((pkgi + 1)..num_of_pkg).map { |deppkgi|
+ deps = Hash[((pkgi + 1)..num_of_pkg).map do |deppkgi|
["pkg#{deppkgi}", ">= 0"]
- }]
+ end]
util_spec "pkg#{pkgi}", pkg_version.to_s, deps
end
end
@@ -156,9 +156,9 @@ end
install_specs base
base.activate
- tms = Benchmark.measure {
+ tms = Benchmark.measure do
assert_raises(LoadError) { require 'no_such_file_foo' }
- }
+ end
assert_operator tms.total, :<=, 10
end
end
@@ -384,7 +384,7 @@ end
# [B] ~> 1.0 (satisfied by 1.0)
def test_self_activate_checks_dependencies
- a = util_spec 'a', '1.0'
+ a = util_spec 'a', '1.0'
a.add_dependency 'c', '= 1.0'
a.add_dependency 'b', '~> 1.0'
@@ -1823,6 +1823,7 @@ dependencies: []
RbConfig::CONFIG['ENABLE_SHARED'], 'no'
class << Gem
+
alias orig_default_ext_dir_for default_ext_dir_for
remove_method :default_ext_dir_for
@@ -1830,6 +1831,7 @@ dependencies: []
def Gem.default_ext_dir_for(base_dir)
'elsewhere'
end
+
end
ext_spec
@@ -1843,9 +1845,11 @@ dependencies: []
RbConfig::CONFIG['ENABLE_SHARED'] = enable_shared
class << Gem
+
remove_method :default_ext_dir_for
alias default_ext_dir_for orig_default_ext_dir_for
+
end
end
@@ -2135,9 +2139,11 @@ dependencies: []
def test_require_paths_default_ext_dir_for
class << Gem
+
send :alias_method, :orig_default_ext_dir_for, :default_ext_dir_for
remove_method :default_ext_dir_for
+
end
def Gem.default_ext_dir_for(base_dir)
@@ -2153,9 +2159,11 @@ dependencies: []
end
ensure
class << Gem
+
send :remove_method, :default_ext_dir_for
send :alias_method, :default_ext_dir_for, :orig_default_ext_dir_for
send :remove_method, :orig_default_ext_dir_for
+
end
end
@@ -2316,8 +2324,8 @@ dependencies: []
s2 = util_spec 'b', '1'
assert_equal(-1, (s1 <=> s2))
- assert_equal( 0, (s1 <=> s1))
- assert_equal( 1, (s2 <=> s1))
+ assert_equal(0, (s1 <=> s1))
+ assert_equal(1, (s2 <=> s1))
end
def test_spaceship_platform
@@ -2326,18 +2334,18 @@ dependencies: []
s.platform = Gem::Platform.new 'x86-my_platform1'
end
- assert_equal( -1, (s1 <=> s2))
- assert_equal( 0, (s1 <=> s1))
- assert_equal( 1, (s2 <=> s1))
+ assert_equal(-1, (s1 <=> s2))
+ assert_equal(0, (s1 <=> s1))
+ assert_equal(1, (s2 <=> s1))
end
def test_spaceship_version
s1 = util_spec 'a', '1'
s2 = util_spec 'a', '2'
- assert_equal( -1, (s1 <=> s2))
- assert_equal( 0, (s1 <=> s1))
- assert_equal( 1, (s2 <=> s1))
+ assert_equal(-1, (s1 <=> s2))
+ assert_equal(0, (s1 <=> s1))
+ assert_equal(1, (s2 <=> s1))
end
def test_spec_file
@@ -2870,7 +2878,7 @@ duplicate dependency on c (>= 1.2.3, development), (~> 1.2) use:
util_setup_validate
FileUtils.mkdir_p File.join(@tempdir, 'bin')
- File.open File.join(@tempdir, 'bin', 'exec'), 'w' do end
+ File.open File.join(@tempdir, 'bin', 'exec'), 'w'
FileUtils.mkdir_p File.join(@tempdir, 'exec')
use_ui @ui do
@@ -3811,4 +3819,5 @@ end
ensure
$VERBOSE = old_verbose
end
+
end
diff --git a/test/rubygems/test_gem_stream_ui.rb b/test/rubygems/test_gem_stream_ui.rb
index 342b7071a6..9b44f3e242 100644
--- a/test/rubygems/test_gem_stream_ui.rb
+++ b/test/rubygems/test_gem_stream_ui.rb
@@ -4,6 +4,7 @@ require 'rubygems/user_interaction'
require 'timeout'
class TestGemStreamUI < Gem::TestCase
+
SHORT_TIMEOUT = (defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled?) ? 1.0 : 0.1 # increase timeout with MJIT for --jit-wait testing
module IsTty
@@ -219,4 +220,5 @@ class TestGemStreamUI < Gem::TestCase
reporter.fetch 'a.gem', 1024
assert_equal "", @out.string
end
+
end
diff --git a/test/rubygems/test_gem_stub_specification.rb b/test/rubygems/test_gem_stub_specification.rb
index 3988206944..13a952d0bd 100644
--- a/test/rubygems/test_gem_stub_specification.rb
+++ b/test/rubygems/test_gem_stub_specification.rb
@@ -3,6 +3,7 @@ require "rubygems/test_case"
require "rubygems/stub_specification"
class TestStubSpecification < Gem::TestCase
+
SPECIFICATIONS = File.expand_path(File.join("..", "specifications"), __FILE__)
FOO = File.join SPECIFICATIONS, "foo-0.0.1-x86-mswin32.gemspec"
BAR = File.join SPECIFICATIONS, "bar-0.0.2.gemspec"
diff --git a/test/rubygems/test_gem_text.rb b/test/rubygems/test_gem_text.rb
index 0249c47f83..4315d358b1 100644
--- a/test/rubygems/test_gem_text.rb
+++ b/test/rubygems/test_gem_text.rb
@@ -3,6 +3,7 @@ require 'rubygems/test_case'
require "rubygems/text"
class TestGemText < Gem::TestCase
+
include Gem::Text
def test_format_text
@@ -89,4 +90,5 @@ Without the wrapping, the text might not look good in the RSS feed.
s = "ab" * 500_001
assert_equal "Truncating desc to 1,000,000 characters:\n#{s[0, 1_000_000]}", truncate_text(s, "desc", 1_000_000)
end
+
end
diff --git a/test/rubygems/test_gem_uninstaller.rb b/test/rubygems/test_gem_uninstaller.rb
index a53526c0bc..126011be99 100644
--- a/test/rubygems/test_gem_uninstaller.rb
+++ b/test/rubygems/test_gem_uninstaller.rb
@@ -368,7 +368,10 @@ create_makefile '#{@spec.name}'
end
def test_uninstall_prompts_about_broken_deps
- quick_gem 'r', '1' do |s| s.add_dependency 'q', '= 1' end
+ quick_gem 'r', '1' do |s|
+ s.add_dependency 'q', '= 1'
+ end
+
quick_gem 'q', '1'
un = Gem::Uninstaller.new('q')
@@ -390,8 +393,14 @@ create_makefile '#{@spec.name}'
end
def test_uninstall_only_lists_unsatisfied_deps
- quick_gem 'r', '1' do |s| s.add_dependency 'q', '~> 1.0' end
- quick_gem 'x', '1' do |s| s.add_dependency 'q', '= 1.0' end
+ quick_gem 'r', '1' do |s|
+ s.add_dependency 'q', '~> 1.0'
+ end
+
+ quick_gem 'x', '1' do |s|
+ s.add_dependency 'q', '= 1.0'
+ end
+
quick_gem 'q', '1.0'
quick_gem 'q', '1.1'
@@ -414,7 +423,10 @@ create_makefile '#{@spec.name}'
end
def test_uninstall_doesnt_prompt_when_other_gem_satisfies_requirement
- quick_gem 'r', '1' do |s| s.add_dependency 'q', '~> 1.0' end
+ quick_gem 'r', '1' do |s|
+ s.add_dependency 'q', '~> 1.0'
+ end
+
quick_gem 'q', '1.0'
quick_gem 'q', '1.1'
@@ -431,7 +443,10 @@ create_makefile '#{@spec.name}'
end
def test_uninstall_doesnt_prompt_when_removing_a_dev_dep
- quick_gem 'r', '1' do |s| s.add_development_dependency 'q', '= 1.0' end
+ quick_gem 'r', '1' do |s|
+ s.add_development_dependency 'q', '= 1.0'
+ end
+
quick_gem 'q', '1.0'
un = Gem::Uninstaller.new('q', :version => "1.0")
@@ -447,7 +462,10 @@ create_makefile '#{@spec.name}'
end
def test_uninstall_doesnt_prompt_and_raises_when_abort_on_dependent_set
- quick_gem 'r', '1' do |s| s.add_dependency 'q', '= 1' end
+ quick_gem 'r', '1' do |s|
+ s.add_dependency 'q', '= 1'
+ end
+
quick_gem 'q', '1'
un = Gem::Uninstaller.new('q', :abort_on_dependent => true)
@@ -502,4 +520,5 @@ create_makefile '#{@spec.name}'
end
end
end
+
end
diff --git a/test/rubygems/test_gem_util.rb b/test/rubygems/test_gem_util.rb
index 88afc62976..a48d275d28 100644
--- a/test/rubygems/test_gem_util.rb
+++ b/test/rubygems/test_gem_util.rb
@@ -51,9 +51,9 @@ class TestGemUtil < Gem::TestCase
end
def test_linked_list_find
- list = [1,2,3,4,5].inject(Gem::List.new(0)) { |m,o|
+ list = [1,2,3,4,5].inject(Gem::List.new(0)) do |m,o|
Gem::List.new o, m
- }
+ end
assert_equal 5, list.find { |x| x == 5 }
assert_equal 4, list.find { |x| x == 4 }
end
diff --git a/test/rubygems/test_gem_version.rb b/test/rubygems/test_gem_version.rb
index 939360c7a2..6d3893c256 100644
--- a/test/rubygems/test_gem_version.rb
+++ b/test/rubygems/test_gem_version.rb
@@ -148,14 +148,14 @@ class TestGemVersion < Gem::TestCase
end
def test_spaceship
- assert_equal( 0, v("1.0") <=> v("1.0.0"))
- assert_equal( 1, v("1.0") <=> v("1.0.a"))
- assert_equal( 1, v("1.8.2") <=> v("0.0.0"))
- assert_equal( 1, v("1.8.2") <=> v("1.8.2.a"))
- assert_equal( 1, v("1.8.2.b") <=> v("1.8.2.a"))
- assert_equal(-1, v("1.8.2.a") <=> v("1.8.2"))
- assert_equal( 1, v("1.8.2.a10") <=> v("1.8.2.a9"))
- assert_equal( 0, v("") <=> v("0"))
+ assert_equal(0, v("1.0") <=> v("1.0.0"))
+ assert_equal(1, v("1.0") <=> v("1.0.a"))
+ assert_equal(1, v("1.8.2") <=> v("0.0.0"))
+ assert_equal(1, v("1.8.2") <=> v("1.8.2.a"))
+ assert_equal(1, v("1.8.2.b") <=> v("1.8.2.a"))
+ assert_equal(-1, v("1.8.2.a") <=> v("1.8.2"))
+ assert_equal(1, v("1.8.2.a10") <=> v("1.8.2.a9"))
+ assert_equal(0, v("") <=> v("0"))
assert_nil v("1.0") <=> "whatever"
end
@@ -284,4 +284,5 @@ class TestGemVersion < Gem::TestCase
def refute_version_equal(unexpected, actual)
refute_equal v(unexpected), v(actual)
end
+
end
diff --git a/test/rubygems/test_kernel.rb b/test/rubygems/test_kernel.rb
index f7d3988ce3..b9f9b5e254 100644
--- a/test/rubygems/test_kernel.rb
+++ b/test/rubygems/test_kernel.rb
@@ -120,4 +120,5 @@ class TestKernel < Gem::TestCase
assert $:.any? { |p| %r{bundler-1/lib} =~ p }
end
end
+
end
diff --git a/test/rubygems/test_remote_fetch_error.rb b/test/rubygems/test_remote_fetch_error.rb
index 432c48b878..780e5e79f7 100644
--- a/test/rubygems/test_remote_fetch_error.rb
+++ b/test/rubygems/test_remote_fetch_error.rb
@@ -17,4 +17,5 @@ class TestRemoteFetchError < Gem::TestCase
error = Gem::RemoteFetcher::FetchError.new('There was an error fetching', 'https://gemsource.org')
assert_equal error.to_s, 'There was an error fetching (https://gemsource.org)'
end
+
end
diff --git a/test/rubygems/test_require.rb b/test/rubygems/test_require.rb
index e3bdc218f7..846826c3f1 100644
--- a/test/rubygems/test_require.rb
+++ b/test/rubygems/test_require.rb
@@ -3,7 +3,9 @@ require 'rubygems/test_case'
require 'rubygems'
class TestGemRequire < Gem::TestCase
+
class Latch
+
def initialize(count = 1)
@count = count
@lock = Monitor.new
@@ -22,6 +24,7 @@ class TestGemRequire < Gem::TestCase
@cv.wait_while { @count > 0 }
end
end
+
end
def setup
@@ -331,8 +334,10 @@ class TestGemRequire < Gem::TestCase
def test_try_activate_error_unlocks_require_monitor
silence_warnings do
class << ::Gem
+
alias old_try_activate try_activate
def try_activate(*); raise 'raised from try_activate'; end
+
end
end
@@ -343,7 +348,9 @@ class TestGemRequire < Gem::TestCase
ensure
silence_warnings do
class << ::Gem
+
alias try_activate old_try_activate
+
end
end
Kernel::RUBYGEMS_ACTIVATION_MONITOR.exit
@@ -436,4 +443,5 @@ class TestGemRequire < Gem::TestCase
ensure
$VERBOSE = old_verbose
end
+
end