diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2019-08-22 17:32:47 +0200 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2019-09-05 18:42:18 +0900 |
commit | f9f6a3d793186bd4b8897f775dcdcc9719361c11 (patch) | |
tree | 6818f778849f65b5a3781631ecfe319d493c4a17 /test/rubygems | |
parent | d84b9b6d0a938cec9f0c1266702d9c4aecc0423a (diff) |
[rubygems/rubygems] Little refactor to avoid rubocop's false positive
Otherwise it detects duplicate methods here, because it doesn't see that
we are reopening the class in two different places.
https://github.com/rubygems/rubygems/commit/ae3fb47f5f
Diffstat (limited to 'test/rubygems')
-rw-r--r-- | test/rubygems/test_gem_commands_push_command.rb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/test/rubygems/test_gem_commands_push_command.rb b/test/rubygems/test_gem_commands_push_command.rb index b4f51cdc35..f666c6d437 100644 --- a/test/rubygems/test_gem_commands_push_command.rb +++ b/test/rubygems/test_gem_commands_push_command.rb @@ -27,25 +27,21 @@ class TestGemCommandsPushCommand < Gem::TestCase @cmd = Gem::Commands::PushCommand.new - class << Gem - + singleton_gem_class.class_eval do alias_method :orig_latest_rubygems_version, :latest_rubygems_version def latest_rubygems_version Gem.rubygems_version end - end end def teardown super - class << Gem - + singleton_gem_class.class_eval do remove_method :latest_rubygems_version alias_method :latest_rubygems_version, :orig_latest_rubygems_version - end end @@ -404,4 +400,10 @@ class TestGemCommandsPushCommand < Gem::TestCase assert_equal '111111', @fetcher.last_request['OTP'] end + private + + def singleton_gem_class + class << Gem; self; end + end + end |