diff options
| author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2025-08-06 22:03:11 +0200 |
|---|---|---|
| committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2025-09-03 23:38:37 +0900 |
| commit | 358735b3ac34bf63a35bc53624424e4ce795816c (patch) | |
| tree | e893a1ad2cf6665ba45210f8a474908c6fae750a | |
| parent | 4a6fa17d1dc56352542e3584ba880b54d9277ac3 (diff) | |
[rubygems/rubygems] Change more source tests to act on configured sources
https://github.com/rubygems/rubygems/commit/7f0c90b3f0
| -rw-r--r-- | test/rubygems/test_gem_commands_sources_command.rb | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/test/rubygems/test_gem_commands_sources_command.rb b/test/rubygems/test_gem_commands_sources_command.rb index 45cb0662f8..47e316973a 100644 --- a/test/rubygems/test_gem_commands_sources_command.rb +++ b/test/rubygems/test_gem_commands_sources_command.rb @@ -382,24 +382,32 @@ beta-gems.example.com is not a URI end def test_execute_remove - @cmd.handle_options %W[--remove #{@gem_repo}] + Gem.configuration.sources = [@new_repo] + + setup_fake_source(@new_repo) + + @cmd.handle_options %W[--remove #{@new_repo}] use_ui @ui do @cmd.execute end - expected = "#{@gem_repo} removed from sources\n" + expected = "#{@new_repo} removed from sources\n" assert_equal expected, @ui.output assert_equal "", @ui.error + ensure + Gem.configuration.sources = nil end def test_execute_remove_no_network + Gem.configuration.sources = [@new_repo] + spec_fetcher - @cmd.handle_options %W[--remove #{@gem_repo}] + @cmd.handle_options %W[--remove #{@new_repo}] - @fetcher.data["#{@gem_repo}Marshal.#{Gem.marshal_version}"] = proc do + @fetcher.data["#{@new_repo}Marshal.#{Gem.marshal_version}"] = proc do raise Gem::RemoteFetcher::FetchError end @@ -407,10 +415,12 @@ beta-gems.example.com is not a URI @cmd.execute end - expected = "#{@gem_repo} removed from sources\n" + expected = "#{@new_repo} removed from sources\n" assert_equal expected, @ui.output assert_equal "", @ui.error + ensure + Gem.configuration.sources = nil end def test_execute_remove_not_present |
