Class: WebMock::HttpLibAdapters::EmHttpRequestAdapter

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

Constant Summary collapse

OriginalHttpClient =
EventMachine::HttpClient
OriginalHttpConnection =
EventMachine::HttpConnection

Class Method Summary collapse

Methods inherited from WebMock::HttpLibAdapter

adapter_for

Class Method Details

.disable!Object



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

def self.disable!
  EventMachine.send(:remove_const, :HttpConnection)
  EventMachine.send(:const_set, :HttpConnection, OriginalHttpConnection)
  EventMachine.send(:remove_const, :HttpClient)
  EventMachine.send(:const_set, :HttpClient, OriginalHttpClient)
end

.enable!Object



20
21
22
23
24
25
# File 'lib/webmock/http_lib_adapters/em_http_request_adapter.rb', line 20

def self.enable!
  EventMachine.send(:remove_const, :HttpConnection)
  EventMachine.send(:const_set, :HttpConnection, EventMachine::WebMockHttpConnection)
  EventMachine.send(:remove_const, :HttpClient)
  EventMachine.send(:const_set, :HttpClient, EventMachine::WebMockHttpClient)
end