[rubygems/rubygems] Fix weirdness of "interrupt" test command
https://github.com/rubygems/rubygems/commit/0a75590ac9
This commit is contained in:
parent
63f31a9ed5
commit
8e73609c7b
11
test/rubygems/rubygems/commands/interrupt_command.rb
Normal file
11
test/rubygems/rubygems/commands/interrupt_command.rb
Normal file
@ -0,0 +1,11 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Gem::Commands::InterruptCommand < Gem::Command
|
||||
def initialize
|
||||
super("interrupt", "Raises an Interrupt Exception", {})
|
||||
end
|
||||
|
||||
def execute
|
||||
raise Interrupt, "Interrupt exception"
|
||||
end
|
||||
end
|
@ -2,23 +2,4 @@
|
||||
|
||||
require "rubygems/command_manager"
|
||||
|
||||
##
|
||||
# This is an example of exactly what NOT to do.
|
||||
#
|
||||
# DO NOT include code like this in your rubygems_plugin.rb
|
||||
|
||||
module Gem::Commands
|
||||
remove_const(:InterruptCommand) if defined?(InterruptCommand)
|
||||
end
|
||||
|
||||
class Gem::Commands::InterruptCommand < Gem::Command
|
||||
def initialize
|
||||
super("interrupt", "Raises an Interrupt Exception", {})
|
||||
end
|
||||
|
||||
def execute
|
||||
raise Interrupt, "Interrupt exception"
|
||||
end
|
||||
end
|
||||
|
||||
Gem::CommandManager.instance.register_command :interrupt
|
||||
|
@ -21,8 +21,6 @@ class TestGem < Gem::TestCase
|
||||
common_installer_setup
|
||||
|
||||
@additional = %w[a b].map {|d| File.join @tempdir, d }
|
||||
|
||||
util_remove_interrupt_command
|
||||
end
|
||||
|
||||
def test_self_finish_resolve
|
||||
@ -1524,8 +1522,6 @@ class TestGem < Gem::TestCase
|
||||
nil
|
||||
end
|
||||
|
||||
util_remove_interrupt_command
|
||||
|
||||
# Should attempt to cause a StandardError
|
||||
with_plugin("standarderror") { Gem.load_env_plugins }
|
||||
begin
|
||||
@ -1534,8 +1530,6 @@ class TestGem < Gem::TestCase
|
||||
nil
|
||||
end
|
||||
|
||||
util_remove_interrupt_command
|
||||
|
||||
# Should attempt to cause an Exception
|
||||
with_plugin("scripterror") { Gem.load_env_plugins }
|
||||
begin
|
||||
@ -1791,11 +1785,6 @@ class TestGem < Gem::TestCase
|
||||
spec
|
||||
end
|
||||
|
||||
def util_remove_interrupt_command
|
||||
Gem::Commands.send :remove_const, :InterruptCommand if
|
||||
Gem::Commands.const_defined? :InterruptCommand
|
||||
end
|
||||
|
||||
def util_cache_dir
|
||||
File.join Gem.dir, "cache"
|
||||
end
|
||||
|
@ -11,8 +11,6 @@ class TestGemCommandsHelpCommand < Gem::TestCase
|
||||
super
|
||||
|
||||
@cmd = Gem::Commands::HelpCommand.new
|
||||
|
||||
load File.expand_path("rubygems_plugin.rb", __dir__) unless Gem::Commands.const_defined? :InterruptCommand
|
||||
end
|
||||
|
||||
def test_gem_help_bad
|
||||
|
Loading…
x
Reference in New Issue
Block a user