summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2024-09-26 13:09:22 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2024-10-02 14:34:54 +0900
commit3d1eb62bf38e6d6691213018ef29a5680f9d2161 (patch)
tree65a0f4bf619c42abe12fddc29a503f731d3b55e8
parent8e73609c7b4c7fdc35e47cefd8f696777c0da5e6 (diff)
[rubygems/rubygems] Standarize "ins" test command too
https://github.com/rubygems/rubygems/commit/517e9a8669
-rw-r--r--test/rubygems/rubygems/commands/ins_command.rb7
-rw-r--r--test/rubygems/test_gem_command_manager.rb9
2 files changed, 12 insertions, 4 deletions
diff --git a/test/rubygems/rubygems/commands/ins_command.rb b/test/rubygems/rubygems/commands/ins_command.rb
new file mode 100644
index 0000000000..8e2ac16f22
--- /dev/null
+++ b/test/rubygems/rubygems/commands/ins_command.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class Gem::Commands::InsCommand < Gem::Command
+ def initialize
+ super("ins", "Does something different from install", {})
+ end
+end
diff --git a/test/rubygems/test_gem_command_manager.rb b/test/rubygems/test_gem_command_manager.rb
index f04ec0cafa..f3848e498d 100644
--- a/test/rubygems/test_gem_command_manager.rb
+++ b/test/rubygems/test_gem_command_manager.rb
@@ -50,16 +50,17 @@ class TestGemCommandManager < Gem::TestCase
end
def test_find_command_ambiguous_exact
- ins_command = Class.new
- Gem::Commands.send :const_set, :InsCommand, ins_command
+ old_load_path = $:.dup
+ $: << File.expand_path("test/rubygems", PROJECT_DIR)
@command_manager.register_command :ins
command = @command_manager.find_command "ins"
- assert_kind_of ins_command, command
+ assert_kind_of Gem::Commands::InsCommand, command
ensure
- Gem::Commands.send :remove_const, :InsCommand
+ $:.replace old_load_path
+ @command_manager.unregister_command :ins
end
def test_find_command_unknown