diff options
Diffstat (limited to 'spec/bundler/support/artifice/fail.rb')
-rw-r--r-- | spec/bundler/support/artifice/fail.rb | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/spec/bundler/support/artifice/fail.rb b/spec/bundler/support/artifice/fail.rb index 6286e43fbd..8822e5b8e2 100644 --- a/spec/bundler/support/artifice/fail.rb +++ b/spec/bundler/support/artifice/fail.rb @@ -1,11 +1,11 @@ # frozen_string_literal: true -require "net/http" +require "bundler/vendored_net_http" -class Fail < Net::HTTP - # Net::HTTP uses a @newimpl instance variable to decide whether +class Fail < Gem::Net::HTTP + # Gem::Net::HTTP uses a @newimpl instance variable to decide whether # to use a legacy implementation. Since we are subclassing - # Net::HTTP, we must set it + # Gem::Net::HTTP, we must set it @newimpl = true def request(req, body = nil, &block) @@ -17,13 +17,11 @@ class Fail < Net::HTTP end def exception(req) - name = ENV.fetch("BUNDLER_SPEC_EXCEPTION") { "Errno::ENETUNREACH" } - const = name.split("::").reduce(Object) {|mod, sym| mod.const_get(sym) } - const.new("host down: Bundler spec artifice fail! #{req["PATH_INFO"]}") + Errno::ENETUNREACH.new("host down: Bundler spec artifice fail! #{req["PATH_INFO"]}") end end require_relative "helpers/artifice" -# Replace Net::HTTP with our failing subclass +# Replace Gem::Net::HTTP with our failing subclass Artifice.replace_net_http(::Fail) |