summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2025-08-06 20:27:03 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2025-09-03 23:38:37 +0900
commite89eb0b973c6d257085dc3cd8d564ea94d07ed94 (patch)
treed55601aad82b972b38cb845e84aa7e8ca027817d
parent92df7e456a05240977e778d6947372e422129669 (diff)
[rubygems/rubygems] Simplify test for trailing slash handling when adding sources
https://github.com/rubygems/rubygems/commit/9c9fd4799f
-rw-r--r--test/rubygems/test_gem_commands_sources_command.rb23
1 files 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