From 3d1eb62bf38e6d6691213018ef29a5680f9d2161 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Thu, 26 Sep 2024 13:09:22 +0200 Subject: [PATCH] [rubygems/rubygems] Standarize "ins" test command too https://github.com/rubygems/rubygems/commit/517e9a8669 --- test/rubygems/rubygems/commands/ins_command.rb | 7 +++++++ test/rubygems/test_gem_command_manager.rb | 9 +++++---- 2 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 test/rubygems/rubygems/commands/ins_command.rb 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