Skip to content

Commit

Permalink
util/rubocop -a
Browse files Browse the repository at this point in the history
  • Loading branch information
hsbt committed May 11, 2021
1 parent 26d6adc commit a10ff97
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions lib/rubygems/test_case.rb
Expand Up @@ -1558,12 +1558,12 @@ def self.key_path(key_name)
end

class Object
def stub name, val_or_callable, *block_args
def stub(name, val_or_callable, *block_args)
new_name = "__minitest_stub__#{name}"

metaclass = class << self; self; end

if respond_to? name and not methods.map(&:to_s).include? name.to_s then
if respond_to? name and not methods.map(&:to_s).include? name.to_s
metaclass.send :define_method, name do |*args|
super(*args)
end
Expand All @@ -1572,7 +1572,7 @@ def stub name, val_or_callable, *block_args
metaclass.send :alias_method, new_name, name

metaclass.send :define_method, name do |*args, &blk|
if val_or_callable.respond_to? :call then
if val_or_callable.respond_to? :call
val_or_callable.call(*args, &blk)
else
blk.call(*block_args) if blk
Expand Down
2 changes: 1 addition & 1 deletion test/rubygems/test_gem_commands_help_command.rb
Expand Up @@ -48,7 +48,7 @@ def test_gem_help_commands
if Gem::HAVE_OPENSSL
assert_empty err

refute_match %r|No command found for |, out
refute_match %r{No command found for }, out
end
end
end
Expand Down
16 changes: 8 additions & 8 deletions test/rubygems/test_gem_package_tar_writer.rb
Expand Up @@ -148,12 +148,12 @@ def test_add_file_signer_empty
end

def test_add_file_simple
@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])
assert_headers_equal(tar_file_header('x', '', 0644, 10, Time.now),
@io.string[0, 512])

assert_equal "aaaaaaaaaa#{"\0" * 502}", @io.string[512, 512]
assert_equal 1024, @io.pos
Expand All @@ -170,10 +170,10 @@ def test_add_file_simple_source_date_epoch
end

def test_add_file_simple_padding
@tar_writer.add_file_simple 'x', 0, 100
@tar_writer.add_file_simple 'x', 0, 100

assert_headers_equal tar_file_header('x', '', 0, 100, Time.now),
@io.string[0, 512]
assert_headers_equal tar_file_header('x', '', 0, 100, Time.now),
@io.string[0, 512]

assert_equal "\0" * 512, @io.string[512, 512]
end
Expand Down
2 changes: 1 addition & 1 deletion test/rubygems/test_gem_request_set.rb
Expand Up @@ -87,7 +87,7 @@ def test_install_from_gemdeps_explain
a-2
EXPECTED

actual, _= capture_output do
actual, _ = capture_output do
rs.install_from_gemdeps :gemdeps => io.path, :explain => true
end
assert_equal(expected, actual)
Expand Down
2 changes: 1 addition & 1 deletion test/rubygems/test_gem_specification.rb
Expand Up @@ -2619,7 +2619,7 @@ def test_to_ruby_platform
def test_to_yaml
yaml_str = @a1.to_yaml

refute_match %r|!!null|, yaml_str
refute_match %r{!!null}, yaml_str

same_spec = Gem::Specification.from_yaml(yaml_str)

Expand Down
2 changes: 1 addition & 1 deletion test/rubygems/test_remote_fetch_error.rb
Expand Up @@ -4,7 +4,7 @@
class TestRemoteFetchError < Gem::TestCase
def test_password_redacted
error = Gem::RemoteFetcher::FetchError.new('There was an error fetching', 'https://user:secret@gemsource.org')
refute_match %r|secret|, error.to_s
refute_match %r{secret}, error.to_s
end

def test_invalid_url
Expand Down

0 comments on commit a10ff97

Please sign in to comment.