aboutsummaryrefslogtreecommitdiffstats
path: root/test/rubygems
diff options
context:
space:
mode:
Diffstat (limited to 'test/rubygems')
-rw-r--r--test/rubygems/test_gem_commands_push_command.rb14
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