Skip to content

Commit 6dcd100

Browse files
deivid-rodriguezhsbt
authored andcommitted
[rubygems/rubygems] Change trailing slash test to not work on default sources
ruby/rubygems@b2daf4707b
1 parent 566cd15 commit 6dcd100

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

test/rubygems/test_gem_commands_sources_command.rb

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,13 +220,14 @@ def test_execute_add_redundant_source
220220
end
221221

222222
def test_execute_add_redundant_source_trailing_slash
223-
spec_fetcher
223+
repo_with_slash = "http://sample.repo/"
224224

225-
repo_with_slash = "http://gems.example.com/"
226225
Gem.configuration.sources = [repo_with_slash]
227226

227+
setup_fake_source(repo_with_slash)
228+
228229
# Re-add pre-existing gem source (w/o slash)
229-
repo_without_slash = "http://gems.example.com"
230+
repo_without_slash = repo_with_slash.delete_suffix("/")
230231
@cmd.handle_options %W[--add #{repo_without_slash}]
231232
use_ui @ui do
232233
@cmd.execute
@@ -235,7 +236,7 @@ def test_execute_add_redundant_source_trailing_slash
235236
assert_equal true, Gem.sources.include?(source)
236237

237238
expected = <<-EOF
238-
source http://gems.example.com already present in the cache
239+
source #{repo_without_slash} already present in the cache
239240
EOF
240241

241242
assert_equal expected, @ui.output
@@ -250,8 +251,8 @@ def test_execute_add_redundant_source_trailing_slash
250251
assert_equal true, Gem.sources.include?(source)
251252

252253
expected = <<-EOF
253-
source http://gems.example.com already present in the cache
254-
source http://gems.example.com/ already present in the cache
254+
source #{repo_without_slash} already present in the cache
255+
source #{repo_with_slash} already present in the cache
255256
EOF
256257

257258
assert_equal expected, @ui.output

0 commit comments

Comments
 (0)