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



23
24
25
26
27
28
# File 'lib/webmock/http_lib_adapters/em_http_request_adapter.rb', line 23

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



16
17
18
19
20
21
# File 'lib/webmock/http_lib_adapters/em_http_request_adapter.rb', line 16

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