summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2025-08-06 21:40:48 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2025-09-03 23:38:37 +0900
commit6dcd100a28c79b25491183611d874c480d24fb3d (patch)
tree28cdd49f758f4ad71243c4dea130832ddbab9686
parent566cd152fbb6762d34c93ba82f94714bde49a575 (diff)
[rubygems/rubygems] Change trailing slash test to not work on default sources
https://github.com/rubygems/rubygems/commit/b2daf4707b
-rw-r--r--test/rubygems/test_gem_commands_sources_command.rb13
1 files changed, 7 insertions, 6 deletions
diff --git a/test/rubygems/test_gem_commands_sources_command.rb b/test/rubygems/test_gem_commands_sources_command.rb
index 9229130daf..973ad9cfa9 100644
--- a/test/rubygems/test_gem_commands_sources_command.rb
+++ b/test/rubygems/test_gem_commands_sources_command.rb
@@ -220,13 +220,14 @@ source #{@gem_repo} already present in the cache
end
def test_execute_add_redundant_source_trailing_slash
- spec_fetcher
+ repo_with_slash = "http://sample.repo/"
- repo_with_slash = "http://gems.example.com/"
Gem.configuration.sources = [repo_with_slash]
+ setup_fake_source(repo_with_slash)
+
# Re-add pre-existing gem source (w/o slash)
- repo_without_slash = "http://gems.example.com"
+ repo_without_slash = repo_with_slash.delete_suffix("/")
@cmd.handle_options %W[--add #{repo_without_slash}]
use_ui @ui do
@cmd.execute
@@ -235,7 +236,7 @@ source #{@gem_repo} already present in the cache
assert_equal true, Gem.sources.include?(source)
expected = <<-EOF
-source http://gems.example.com already present in the cache
+source #{repo_without_slash} already present in the cache
EOF
assert_equal expected, @ui.output
@@ -250,8 +251,8 @@ source http://gems.example.com already present in the cache
assert_equal true, Gem.sources.include?(source)
expected = <<-EOF
-source http://gems.example.com already present in the cache
-source http://gems.example.com/ already present in the cache
+source #{repo_without_slash} already present in the cache
+source #{repo_with_slash} already present in the cache
EOF
assert_equal expected, @ui.output