diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2023-04-19 18:27:31 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-04-20 01:57:16 +0000 |
commit | dbcdac00e6b9b9b72c0679e54d2ecef02a9cf3bc (patch) | |
tree | 212628cb1cdf33792195a1c85af731f8c1202b66 /spec/bundler | |
parent | 5579cbe2dd6fda86d2c31c9c0a6ee4697fc31e26 (diff) | |
download | ruby-dbcdac00e6b9b9b72c0679e54d2ecef02a9cf3bc.tar.gz |
[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
Diffstat (limited to 'spec/bundler')
-rw-r--r-- | spec/bundler/bundler/friendly_errors_spec.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/bundler/bundler/friendly_errors_spec.rb b/spec/bundler/bundler/friendly_errors_spec.rb index 17ca15ed8b..37afe488f3 100644 --- a/spec/bundler/bundler/friendly_errors_spec.rb +++ b/spec/bundler/bundler/friendly_errors_spec.rb @@ -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) |