Skip to content

Commit

Permalink
Update for compatibilty with new minitest
Browse files Browse the repository at this point in the history
  • Loading branch information
MSP-Greg committed Dec 20, 2017
1 parent 9a18b82 commit f1eb3b8
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 30 deletions.
2 changes: 1 addition & 1 deletion lib/rubygems/test_case.rb
Expand Up @@ -84,7 +84,7 @@ module DefaultUserInteraction
#
# Tests are always run at a safe level of 1.

class Gem::TestCase < MiniTest::Unit::TestCase
class Gem::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Unit::TestCase)

attr_accessor :fetcher # :nodoc:

Expand Down
6 changes: 3 additions & 3 deletions test/rubygems/test_gem.rb
Expand Up @@ -1587,7 +1587,7 @@ def test_register_default_spec

assert_equal old_style, Gem.find_unresolved_default_spec("foo.rb")
assert_equal old_style, Gem.find_unresolved_default_spec("bar.rb")
assert_equal nil, Gem.find_unresolved_default_spec("baz.rb")
assert_nil Gem.find_unresolved_default_spec("baz.rb")

Gem.clear_default_specs

Expand All @@ -1600,8 +1600,8 @@ def test_register_default_spec

assert_equal new_style, Gem.find_unresolved_default_spec("foo.rb")
assert_equal new_style, Gem.find_unresolved_default_spec("bar.rb")
assert_equal nil, Gem.find_unresolved_default_spec("exec")
assert_equal nil, Gem.find_unresolved_default_spec("README")
assert_nil Gem.find_unresolved_default_spec("exec")
assert_nil Gem.find_unresolved_default_spec("README")
end

def test_default_gems_use_full_paths
Expand Down
4 changes: 2 additions & 2 deletions test/rubygems/test_gem_command_manager.rb
Expand Up @@ -114,8 +114,8 @@ def test_process_args_install
assert_equal :both, check_options[:domain]
assert_equal true, check_options[:wrappers]
assert_equal Gem::Requirement.default, check_options[:version]
assert_equal nil, check_options[:install_dir]
assert_equal nil, check_options[:bin_dir]
assert_nil check_options[:install_dir]
assert_nil check_options[:bin_dir]

#check settings
check_options = nil
Expand Down
8 changes: 5 additions & 3 deletions test/rubygems/test_gem_commands_setup_command.rb
Expand Up @@ -6,6 +6,8 @@

class TestGemCommandsSetupCommand < Gem::TestCase

BUNDLER_VERS = `gem list -e bundler`[/([^() ]+)\)\Z/, 1] || "1.16.0"

def setup
super

Expand All @@ -32,7 +34,7 @@ def setup

gemspec = Gem::Specification.new
gemspec.name = "bundler"
gemspec.version = "1.16.0"
gemspec.version = BUNDLER_VERS
gemspec.bindir = "exe"
gemspec.executables = ["bundle"]

Expand Down Expand Up @@ -136,8 +138,8 @@ def test_install_default_bundler_gem
refute_path_exists File.join(default_dir, "bundler-1.15.4.gemspec")
refute_path_exists 'default/gems/bundler-1.15.4'

assert_path_exists File.join(default_dir, "bundler-1.16.0.gemspec")
assert_path_exists 'default/gems/bundler-1.16.0'
assert_path_exists File.join(default_dir, "bundler-#{BUNDLER_VERS}.gemspec")
assert_path_exists "default/gems/bundler-#{BUNDLER_VERS}"

assert_path_exists File.join(Gem.default_dir, "specifications", "bundler-audit-1.0.0.gemspec")
assert_path_exists 'default/gems/bundler-audit-1.0.0'
Expand Down
2 changes: 1 addition & 1 deletion test/rubygems/test_gem_commands_signin_command.rb
Expand Up @@ -48,7 +48,7 @@ def test_execute_when_already_signed_in_with_different_host

assert_equal credentials[:rubygems_api_key], api_key

assert_equal credentials[host], nil
assert_nil credentials[host]
end

def test_execute_with_host_supplied
Expand Down
2 changes: 1 addition & 1 deletion test/rubygems/test_gem_commands_uninstall_command.rb
Expand Up @@ -238,7 +238,7 @@ def test_handle_options
@cmd.handle_options %w[]

assert_equal false, @cmd.options[:check_dev]
assert_equal nil, @cmd.options[:install_dir]
assert_nil @cmd.options[:install_dir]
assert_equal true, @cmd.options[:user_install]
assert_equal Gem::Requirement.default, @cmd.options[:version]
assert_equal false, @cmd.options[:vendor]
Expand Down
4 changes: 0 additions & 4 deletions test/rubygems/test_gem_ext_rake_builder.rb
Expand Up @@ -16,11 +16,9 @@ def setup
def test_class_build
create_temp_mkrf_file('task :default')
output = []
realdir = nil # HACK /tmp vs. /private/tmp

build_rake_in do |rake|
Dir.chdir @ext do
realdir = Dir.pwd
Gem::Ext::RakeBuilder.build 'mkrf_conf.rb', nil, @dest_path, output
end

Expand All @@ -38,11 +36,9 @@ def test_class_build
def test_class_build_with_args
create_temp_mkrf_file('task :default')
output = []
realdir = nil # HACK /tmp vs. /private/tmp

build_rake_in do |rake|
Dir.chdir @ext do
realdir = Dir.pwd
non_empty_args_list = ['']
Gem::Ext::RakeBuilder.build 'mkrf_conf.rb', nil, @dest_path, output, non_empty_args_list
end
Expand Down
6 changes: 3 additions & 3 deletions test/rubygems/test_gem_installer.rb
Expand Up @@ -21,7 +21,7 @@ def setup
super
common_installer_setup

if __name__ =~ /^test_install(_|$)/ then
if (self.class.method_defined?(:__name__) ? __name__ : name) =~ /\Atest_install(_|\Z)/
FileUtils.rm_r @spec.gem_dir
FileUtils.rm_r @user_spec.gem_dir
end
Expand All @@ -34,7 +34,7 @@ def teardown

super

Gem.configuration = @config
Gem.configuration = instance_variable_defined?(:@config) ? @config : nil
end

def test_app_script_text
Expand Down Expand Up @@ -659,7 +659,7 @@ def test_generate_bin_symlink_win32
assert_path_exists installed_exec

if symlink_supported?
assert_send([File, :symlink?, installed_exec])
assert File.symlink?(installed_exec)
return
end

Expand Down
2 changes: 1 addition & 1 deletion test/rubygems/test_gem_resolver_installer_set.rb
Expand Up @@ -197,7 +197,7 @@ def (set.remote_set).prefetch(_)
def (set.remote_set).prefetch(_)
raise "called"
end
assert_equal nil, set.prefetch(nil)
assert_nil set.prefetch(nil)
end

def test_prerelease_equals
Expand Down
18 changes: 9 additions & 9 deletions test/rubygems/test_gem_specification.rb
Expand Up @@ -1132,7 +1132,7 @@ def test_handles_private_null_type

data = Marshal.load Gem.inflate(Gem.read_binary(path))

assert_equal nil, data.rubyforge_project
assert_nil data.rubyforge_project
end

def test_emits_zulu_timestamps_properly
Expand All @@ -1153,7 +1153,7 @@ def test_initialize
assert_equal "blah", spec.name
assert_equal "1.3.5", spec.version.to_s
assert_equal Gem::Platform::RUBY, spec.platform
assert_equal nil, spec.summary
assert_nil spec.summary
assert_equal [], spec.files

assert_equal [], spec.test_files
Expand Down Expand Up @@ -1330,31 +1330,31 @@ def test_bindir_equals_nil
@a2.bindir = nil
@a2.executable = 'app'

assert_equal nil, @a2.bindir
assert_nil @a2.bindir
assert_equal %w[app lib/code.rb].sort, @a2.files
end

def test_extensions_equals_nil
@a2.instance_variable_set(:@extensions, nil)
assert_equal nil, @a2.instance_variable_get(:@extensions)
assert_nil @a2.instance_variable_get(:@extensions)
assert_equal %w[lib/code.rb], @a2.files
end

def test_test_files_equals_nil
@a2.instance_variable_set(:@test_files, nil)
assert_equal nil, @a2.instance_variable_get(:@test_files)
assert_nil @a2.instance_variable_get(:@test_files)
assert_equal %w[lib/code.rb], @a2.files
end

def test_executables_equals_nil
@a2.instance_variable_set(:@executables, nil)
assert_equal nil, @a2.instance_variable_get(:@executables)
assert_nil @a2.instance_variable_get(:@executables)
assert_equal %w[lib/code.rb], @a2.files
end

def test_extra_rdoc_files_equals_nil
@a2.instance_variable_set(:@extra_rdoc_files, nil)
assert_equal nil, @a2.instance_variable_get(:@extra_rdoc_files)
assert_nil @a2.instance_variable_get(:@extra_rdoc_files)
assert_equal %w[lib/code.rb], @a2.files
end

Expand Down Expand Up @@ -2206,7 +2206,7 @@ def test_requirements
end

def test_allowed_push_host
assert_equal nil, @a1.metadata['allowed_push_host']
assert_nil @a1.metadata['allowed_push_host']
assert_equal 'https://privategemserver.com', @a3.metadata['allowed_push_host']
end

Expand Down Expand Up @@ -3534,7 +3534,7 @@ def test_find_inactive_by_path

assert_equal a, Gem::Specification.find_inactive_by_path('foo')
a.activate
assert_equal nil, Gem::Specification.find_inactive_by_path('foo')
assert_nil Gem::Specification.find_inactive_by_path('foo')
end

def test_load_default_gem
Expand Down
4 changes: 2 additions & 2 deletions test/rubygems/test_gem_stream_ui.rb
Expand Up @@ -55,7 +55,7 @@ def test_ask_no_tty

Timeout.timeout(0.1) do
answer = @sui.ask("what is your favorite color?")
assert_equal nil, answer
assert_nil answer
end
end

Expand All @@ -79,7 +79,7 @@ def test_ask_for_password_no_tty

Timeout.timeout(0.1) do
answer = @sui.ask_for_password("what is the airspeed velocity of an unladen swallow?")
assert_equal nil, answer
assert_nil answer
end
end

Expand Down

0 comments on commit f1eb3b8

Please sign in to comment.