From e89eb0b973c6d257085dc3cd8d564ea94d07ed94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Wed, 6 Aug 2025 20:27:03 +0200 Subject: [rubygems/rubygems] Simplify test for trailing slash handling when adding sources https://github.com/rubygems/rubygems/commit/9c9fd4799f --- test/rubygems/test_gem_commands_sources_command.rb | 23 +++++----------------- 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/test/rubygems/test_gem_commands_sources_command.rb b/test/rubygems/test_gem_commands_sources_command.rb index 5f15d038c9..4d54844aec 100644 --- a/test/rubygems/test_gem_commands_sources_command.rb +++ b/test/rubygems/test_gem_commands_sources_command.rb @@ -274,21 +274,8 @@ source #{@gem_repo} already present in the cache def test_execute_add_redundant_source_trailing_slash spec_fetcher - # Remove pre-existing gem source (w/ slash) repo_with_slash = "http://gems.example.com/" - @cmd.handle_options %W[--remove #{repo_with_slash}] - use_ui @ui do - @cmd.execute - end - source = Gem::Source.new repo_with_slash - assert_equal false, Gem.sources.include?(source) - - expected = <<-EOF -#{repo_with_slash} removed from sources - EOF - - assert_equal expected, @ui.output - assert_equal "", @ui.error + Gem.configuration.sources = [repo_with_slash] # Re-add pre-existing gem source (w/o slash) repo_without_slash = "http://gems.example.com" @@ -300,8 +287,7 @@ source #{@gem_repo} already present in the cache assert_equal true, Gem.sources.include?(source) expected = <<-EOF -http://gems.example.com/ removed from sources -http://gems.example.com added to sources +source http://gems.example.com already present in the cache EOF assert_equal expected, @ui.output @@ -316,13 +302,14 @@ http://gems.example.com added to sources assert_equal true, Gem.sources.include?(source) expected = <<-EOF -http://gems.example.com/ removed from sources -http://gems.example.com added to sources +source http://gems.example.com already present in the cache source http://gems.example.com/ already present in the cache EOF assert_equal expected, @ui.output assert_equal "", @ui.error + ensure + Gem.configuration.sources = nil end def test_execute_add_http_rubygems_org -- cgit v1.2.3