ruby-changes:61134
From: Hiroshi <ko1@a...>
Date: Fri, 8 May 2020 14:14:57 +0900 (JST)
Subject: [ruby-changes:61134] b9031b1043 (master): [rubygems/rubygems] Restore the old .gemrc example for compatible tests
https://git.ruby-lang.org/ruby.git/commit/?id=b9031b1043 From b9031b10431b4ca517b520ddb9f86d82f16a3372 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA <hsbt@r...> Date: Wed, 29 Apr 2020 20:17:43 +0900 Subject: [rubygems/rubygems] Restore the old .gemrc example for compatible tests https://github.com/rubygems/rubygems/commit/c45d65a06d diff --git a/spec/bundler/bundler/friendly_errors_spec.rb b/spec/bundler/bundler/friendly_errors_spec.rb index 8df653c..dc9d539 100644 --- a/spec/bundler/bundler/friendly_errors_spec.rb +++ b/spec/bundler/bundler/friendly_errors_spec.rb @@ -6,33 +6,59 @@ require "cgi" https://github.com/ruby/ruby/blob/trunk/spec/bundler/bundler/friendly_errors_spec.rb#L6 RSpec.describe Bundler, "friendly errors" do context "with invalid YAML in .gemrc" do - let(:config_home) { File.dirname(Gem.configuration.config_file_name) } + context "with the old ~/.gemrc" do + before do + File.open(home(".gemrc"), "w") do |f| + f.write "invalid: yaml: hah" + end + end - before do - FileUtils.mkdir_p config_home - File.open(Gem.configuration.config_file_name, "w") do |f| - f.write "invalid: yaml: hah" + after do + FileUtils.rm(home(".gemrc")) end - end - after do - FileUtils.rm(Gem.configuration.config_file_name) + 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")}") + expect(exitstatus).to eq(0) if exitstatus + end end - it "reports a relevant friendly error message" do - gemfile <<-G - source "#{file_uri_for(gem_repo1)}" - gem "rack" - G + context "with XDG_CONFIG_HOME" do + let(:config_home) { File.dirname(Gem.configuration.config_file_name) } - bundle :install, :env => { "DEBUG" => "true" } + before do + FileUtils.mkdir_p config_home + File.open(Gem.configuration.config_file_name, "w") do |f| + f.write "invalid: yaml: hah" + end + end - if Gem::VERSION >= "3.2.0.pre.1" - expect(err).to include("Failed to load #{File.join(config_home, "gemrc")}") - else - expect(err).to include("Failed to load #{home(".gemrc")}") + after do + FileUtils.rm(Gem.configuration.config_file_name) + 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" } + + if Gem::VERSION >= "3.2.0.pre.1" + expect(err).to include("Failed to load #{File.join(config_home, "gemrc")}") + else + expect(err).to include("Failed to load #{home(".gemrc")}") + end + expect(exitstatus).to eq(0) if exitstatus end - expect(exitstatus).to eq(0) if exitstatus end end -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/