1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[rubygems/rubygems] Restore the old .gemrc example for compatible tests

https://github.com/rubygems/rubygems/commit/c45d65a06d
This commit is contained in:
Hiroshi SHIBATA 2020-04-29 20:17:43 +09:00
parent 4e436e605c
commit b9031b1043
Notes: git 2020-05-08 14:14:06 +09:00

View file

@ -6,33 +6,59 @@ require "cgi"
RSpec.describe Bundler, "friendly errors" do RSpec.describe Bundler, "friendly errors" do
context "with invalid YAML in .gemrc" 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
before do File.open(home(".gemrc"), "w") do |f|
FileUtils.mkdir_p config_home f.write "invalid: yaml: hah"
File.open(Gem.configuration.config_file_name, "w") do |f| end
f.write "invalid: yaml: hah"
end end
end
after do after do
FileUtils.rm(Gem.configuration.config_file_name) FileUtils.rm(home(".gemrc"))
end end
it "reports a relevant friendly error message" do it "reports a relevant friendly error message" do
gemfile <<-G gemfile <<-G
source "#{file_uri_for(gem_repo1)}" source "#{file_uri_for(gem_repo1)}"
gem "rack" gem "rack"
G G
bundle :install, :env => { "DEBUG" => "true" } 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")}") expect(err).to include("Failed to load #{home(".gemrc")}")
expect(exitstatus).to eq(0) if exitstatus
end
end
context "with XDG_CONFIG_HOME" do
let(:config_home) { File.dirname(Gem.configuration.config_file_name) }
before do
FileUtils.mkdir_p config_home
File.open(Gem.configuration.config_file_name, "w") do |f|
f.write "invalid: yaml: hah"
end
end
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 end
expect(exitstatus).to eq(0) if exitstatus
end end
end end