Skip to content

Commit 358735b

Browse files
deivid-rodriguezhsbt
authored andcommitted
[rubygems/rubygems] Change more source tests to act on configured sources
ruby/rubygems@7f0c90b3f0
1 parent 4a6fa17 commit 358735b

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

test/rubygems/test_gem_commands_sources_command.rb

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -382,35 +382,45 @@ def test_execute_list
382382
end
383383

384384
def test_execute_remove
385-
@cmd.handle_options %W[--remove #{@gem_repo}]
385+
Gem.configuration.sources = [@new_repo]
386+
387+
setup_fake_source(@new_repo)
388+
389+
@cmd.handle_options %W[--remove #{@new_repo}]
386390

387391
use_ui @ui do
388392
@cmd.execute
389393
end
390394

391-
expected = "#{@gem_repo} removed from sources\n"
395+
expected = "#{@new_repo} removed from sources\n"
392396

393397
assert_equal expected, @ui.output
394398
assert_equal "", @ui.error
399+
ensure
400+
Gem.configuration.sources = nil
395401
end
396402

397403
def test_execute_remove_no_network
404+
Gem.configuration.sources = [@new_repo]
405+
398406
spec_fetcher
399407

400-
@cmd.handle_options %W[--remove #{@gem_repo}]
408+
@cmd.handle_options %W[--remove #{@new_repo}]
401409

402-
@fetcher.data["#{@gem_repo}Marshal.#{Gem.marshal_version}"] = proc do
410+
@fetcher.data["#{@new_repo}Marshal.#{Gem.marshal_version}"] = proc do
403411
raise Gem::RemoteFetcher::FetchError
404412
end
405413

406414
use_ui @ui do
407415
@cmd.execute
408416
end
409417

410-
expected = "#{@gem_repo} removed from sources\n"
418+
expected = "#{@new_repo} removed from sources\n"
411419

412420
assert_equal expected, @ui.output
413421
assert_equal "", @ui.error
422+
ensure
423+
Gem.configuration.sources = nil
414424
end
415425

416426
def test_execute_remove_not_present

0 commit comments

Comments
 (0)