Class: WebMock::HttpLibAdapters::HTTPClientAdapter

Inherits:
WebMock::HttpLibAdapter show all
Defined in:
lib/webmock/http_lib_adapters/httpclient_adapter.rb

Constant Summary collapse

OriginalHttpClient =
::HTTPClient
OriginalJsonClient =
::JSONClient

Class Method Summary collapse

Methods inherited from WebMock::HttpLibAdapter

adapter_for

Class Method Details

.disable!Object



35
36
37
38
39
40
41
42
# File 'lib/webmock/http_lib_adapters/httpclient_adapter.rb', line 35

def self.disable!
  Object.send(:remove_const, :HTTPClient)
  Object.send(:const_set, :HTTPClient, OriginalHttpClient)
  if defined? ::JSONClient
    Object.send(:remove_const, :JSONClient)
    Object.send(:const_set, :JSONClient, OriginalJsonClient)
  end
end

.enable!Object



26
27
28
29
30
31
32
33
# File 'lib/webmock/http_lib_adapters/httpclient_adapter.rb', line 26

def self.enable!
  Object.send(:remove_const, :HTTPClient)
  Object.send(:const_set, :HTTPClient, WebMockHTTPClient)
  if defined? ::JSONClient
    Object.send(:remove_const, :JSONClient)
    Object.send(:const_set, :JSONClient, WebMockJSONClient)
  end
end