spec/monkey_patches.rb in vcr-3.0.0 vs spec/monkey_patches.rb in vcr-3.0.1
- old
+ new
@@ -1,7 +1,5 @@
-require 'typhoeus'
-
module MonkeyPatches
extend self
NET_HTTP_SINGLETON = class << Net::HTTP; self; end
@@ -132,13 +130,19 @@
# Require all the HTTP libraries--these must be required before WebMock
# for WebMock to work with them.
require 'httpclient'
-unless RUBY_INTERPRETER == :jruby
- require 'patron'
- require 'em-http-request'
- require 'curb'
+if RUBY_INTERPRETER == :mri
+ require 'typhoeus'
+ begin
+ require 'patron'
+ require 'em-http-request'
+ require 'curb'
+ rescue LoadError
+ # these are not always available, depending on the Gemfile used
+ warn $!.message
+ end
end
if defined?(::Typhoeus.before)
require 'vcr/library_hooks/typhoeus'
$typhoeus_after_loaded_hook = VCR.configuration.hooks[:after_library_hooks_loaded].last