Skip to content

Commit e89eb0b

Browse files
deivid-rodriguezhsbt
authored andcommitted
[rubygems/rubygems] Simplify test for trailing slash handling when adding sources
ruby/rubygems@9c9fd4799f
1 parent 92df7e4 commit e89eb0b

File tree

1 file changed

+5
-18
lines changed

1 file changed

+5
-18
lines changed

test/rubygems/test_gem_commands_sources_command.rb

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -274,21 +274,8 @@ def test_execute_add_redundant_source
274274
def test_execute_add_redundant_source_trailing_slash
275275
spec_fetcher
276276

277-
# Remove pre-existing gem source (w/ slash)
278277
repo_with_slash = "http://gems.example.com/"
279-
@cmd.handle_options %W[--remove #{repo_with_slash}]
280-
use_ui @ui do
281-
@cmd.execute
282-
end
283-
source = Gem::Source.new repo_with_slash
284-
assert_equal false, Gem.sources.include?(source)
285-
286-
expected = <<-EOF
287-
#{repo_with_slash} removed from sources
288-
EOF
289-
290-
assert_equal expected, @ui.output
291-
assert_equal "", @ui.error
278+
Gem.configuration.sources = [repo_with_slash]
292279

293280
# Re-add pre-existing gem source (w/o slash)
294281
repo_without_slash = "http://gems.example.com"
@@ -300,8 +287,7 @@ def test_execute_add_redundant_source_trailing_slash
300287
assert_equal true, Gem.sources.include?(source)
301288

302289
expected = <<-EOF
303-
http://gems.example.com/ removed from sources
304-
http://gems.example.com added to sources
290+
source http://gems.example.com already present in the cache
305291
EOF
306292

307293
assert_equal expected, @ui.output
@@ -316,13 +302,14 @@ def test_execute_add_redundant_source_trailing_slash
316302
assert_equal true, Gem.sources.include?(source)
317303

318304
expected = <<-EOF
319-
http://gems.example.com/ removed from sources
320-
http://gems.example.com added to sources
305+
source http://gems.example.com already present in the cache
321306
source http://gems.example.com/ already present in the cache
322307
EOF
323308

324309
assert_equal expected, @ui.output
325310
assert_equal "", @ui.error
311+
ensure
312+
Gem.configuration.sources = nil
326313
end
327314

328315
def test_execute_add_http_rubygems_org

0 commit comments

Comments
 (0)