[rubygems/rubygems] Revert "Bundler::YAMLSerializer.load couldn't raise error when invalid yaml was provided"

This reverts commit https://github.com/rubygems/rubygems/commit/cfcfde04c783.

https://github.com/rubygems/rubygems/commit/ac21ae7083
This commit is contained in:
Hiroshi SHIBATA 2023-04-19 18:27:31 +09:00 коммит произвёл git
Родитель 5579cbe2dd
Коммит dbcdac00e6
2 изменённых файлов: 38 добавлений и 0 удалений

Просмотреть файл

@ -5,6 +5,29 @@ require "bundler/friendly_errors"
require "cgi"
RSpec.describe Bundler, "friendly errors" do
context "with invalid YAML in .gemrc" do
before do
File.open(home(".gemrc"), "w") do |f|
f.write "invalid: yaml: hah"
end
end
after do
FileUtils.rm(home(".gemrc"))
end
it "reports a relevant friendly error message" do
gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem "rack"
G
bundle :install, :env => { "DEBUG" => "true" }
expect(err).to include("Failed to load #{home(".gemrc")}")
end
end
it "calls log_error in case of exception" do
exception = Exception.new
expect(Bundler::FriendlyErrors).to receive(:exit_status).with(exception).and_return(1)

Просмотреть файл

@ -465,6 +465,21 @@ if you believe they were disclosed to a third party.
assert_equal %w[http://even-more-gems.example.com], Gem.sources
end
def test_ignore_invalid_config_file
File.open @temp_conf, "w" do |fp|
fp.puts "invalid: yaml:"
end
begin
verbose = $VERBOSE
$VERBOSE = nil
util_config_file
ensure
$VERBOSE = verbose
end
end
def test_load_ssl_verify_mode_from_config
File.open @temp_conf, "w" do |fp|
fp.puts ":ssl_verify_mode: 1"