summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/PULL_REQUEST_TEMPLATE.md21
-rw-r--r--lib/bundler/friendly_errors.rb3
-rw-r--r--spec/bundler/compact_index_client/updater_spec.rb4
-rw-r--r--spec/bundler/friendly_errors_spec.rb15
-rw-r--r--spec/cache/path_spec.rb7
5 files changed, 22 insertions, 28 deletions
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 67dfa5b2c6..a721e8bf0d 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -1,18 +1,19 @@
+<!--
Thanks so much for the contribution!
-To make reviewing this PR a bit easier, please fill out answers to the following questions.
-### What was the end-user problem that led to this PR?
+If you're updating documentation, make sure you run `bin/rake man:build` and
+squash the result into your changes, so that all documentation formats are
+updated.
-The problem was...
+To make reviewing this PR a bit easier, please fill out answers to the following questions.
+-->
-### What was your diagnosis of the problem?
+### What was the end-user or developer problem that led to this PR?
-My diagnosis was...
+<!-- Write a clear and complete description of the problem -->
### What is your fix for the problem, implemented in this PR?
-My fix...
-
-### Why did you choose this fix out of the possible options?
-
-I chose this fix because...
+<!-- Explain the fix being implemented. Include any diagnosis you run to
+determine the cause of the issue and your conclusions. If you considered other
+alternatives, explain why you end up choosing the current implementation -->
diff --git a/lib/bundler/friendly_errors.rb b/lib/bundler/friendly_errors.rb
index 080697b02c..046a666003 100644
--- a/lib/bundler/friendly_errors.rb
+++ b/lib/bundler/friendly_errors.rb
@@ -23,13 +23,12 @@ module Bundler
Bundler.ui.error error.message
when LoadError
raise error unless error.message =~ /cannot load such file -- openssl|openssl.so|libcrypto.so/
- Bundler.ui.error "\nCould not load OpenSSL."
+ Bundler.ui.error "\nCould not load OpenSSL. #{error.class}: #{error}\n#{error.backtrace.join("\n ")}"
Bundler.ui.warn <<-WARN, :wrap => true
You must recompile Ruby with OpenSSL support or change the sources in your \
Gemfile from 'https' to 'http'. Instructions for compiling with OpenSSL \
using RVM are available at https://rvm.io/packages/openssl.
WARN
- Bundler.ui.trace error
when Interrupt
Bundler.ui.error "\nQuitting..."
Bundler.ui.trace error
diff --git a/spec/bundler/compact_index_client/updater_spec.rb b/spec/bundler/compact_index_client/updater_spec.rb
index cbbfba7cb8..26159dccd8 100644
--- a/spec/bundler/compact_index_client/updater_spec.rb
+++ b/spec/bundler/compact_index_client/updater_spec.rb
@@ -9,7 +9,7 @@ RSpec.describe Bundler::CompactIndexClient::Updater do
let(:local_path) { Pathname("/tmp/localpath") }
let(:remote_path) { double(:remote_path) }
- subject(:updater) { described_class.new(fetcher) }
+ let!(:updater) { described_class.new(fetcher) }
context "when the ETag header is missing" do
# Regression test for https://github.com/rubygems/bundler/issues/5463
@@ -42,8 +42,6 @@ RSpec.describe Bundler::CompactIndexClient::Updater do
end
context "when bundler doesn't have permissions on Dir.tmpdir" do
- let(:response) { double(:response, :body => "") }
-
it "Errno::EACCES is raised" do
allow(Dir).to receive(:mktmpdir) { raise Errno::EACCES }
diff --git a/spec/bundler/friendly_errors_spec.rb b/spec/bundler/friendly_errors_spec.rb
index e9189b0514..e7addda3f2 100644
--- a/spec/bundler/friendly_errors_spec.rb
+++ b/spec/bundler/friendly_errors_spec.rb
@@ -7,13 +7,13 @@ require "cgi"
RSpec.describe Bundler, "friendly errors" do
context "with invalid YAML in .gemrc" do
before do
- File.open(Gem.configuration.config_file_name, "w") do |f|
+ File.open(home(".gemrc"), "w") do |f|
f.write "invalid: yaml: hah"
end
end
after do
- FileUtils.rm(Gem.configuration.config_file_name)
+ FileUtils.rm(home(".gemrc"))
end
it "reports a relevant friendly error message" do
@@ -115,8 +115,12 @@ RSpec.describe Bundler, "friendly errors" do
context "LoadError" do
let(:error) { LoadError.new("cannot load such file -- openssl") }
+ before do
+ allow(error).to receive(:backtrace).and_return(["backtrace"])
+ end
+
it "Bundler.ui receive error" do
- expect(Bundler.ui).to receive(:error).with("\nCould not load OpenSSL.")
+ expect(Bundler.ui).to receive(:error).with("\nCould not load OpenSSL. LoadError: cannot load such file -- openssl\nbacktrace")
Bundler::FriendlyErrors.log_error(error)
end
@@ -124,11 +128,6 @@ RSpec.describe Bundler, "friendly errors" do
expect(Bundler.ui).to receive(:warn).with(any_args, :wrap => true)
Bundler::FriendlyErrors.log_error(error)
end
-
- it "Bundler.ui receive trace" do
- expect(Bundler.ui).to receive(:trace).with(error)
- Bundler::FriendlyErrors.log_error(error)
- end
end
context "Interrupt" do
diff --git a/spec/cache/path_spec.rb b/spec/cache/path_spec.rb
index 79e8b4a82b..bd47ac925d 100644
--- a/spec/cache/path_spec.rb
+++ b/spec/cache/path_spec.rb
@@ -26,13 +26,12 @@ RSpec.describe "bundle cache with path" do
expect(bundled_app("vendor/cache/foo-1.0")).to exist
expect(bundled_app("vendor/cache/foo-1.0/.bundlecache")).to be_file
- FileUtils.rm_rf lib_path("foo-1.0")
expect(the_bundle).to include_gems "foo 1.0"
end
it "copies when the path is outside the bundle and the paths intersect" do
- libname = File.basename(Dir.pwd) + "_gem"
- libpath = File.join(File.dirname(Dir.pwd), libname)
+ libname = File.basename(bundled_app) + "_gem"
+ libpath = File.join(File.dirname(bundled_app), libname)
build_lib libname, :path => libpath
@@ -45,7 +44,6 @@ RSpec.describe "bundle cache with path" do
expect(bundled_app("vendor/cache/#{libname}")).to exist
expect(bundled_app("vendor/cache/#{libname}/.bundlecache")).to be_file
- FileUtils.rm_rf libpath
expect(the_bundle).to include_gems "#{libname} 1.0"
end
@@ -66,7 +64,6 @@ RSpec.describe "bundle cache with path" do
bundle :cache
expect(bundled_app("vendor/cache/foo-1.0")).to exist
- FileUtils.rm_rf lib_path("foo-1.0")
run "require 'foo'"
expect(out).to eq("CACHE")