Class: WebMock::HttpLibAdapters::HttpxAdapter

Inherits:
HttpLibAdapter
  • Object
show all
Defined in:
lib/httpx/adapters/webmock.rb

Class Method Summary collapse

Class Method Details

.disable!Object



155
156
157
158
159
160
# File 'lib/httpx/adapters/webmock.rb', line 155

def disable!
  return unless @original_session

  HTTPX.send(:remove_const, :Session)
  HTTPX.send(:const_set, :Session, @original_session)
end

.enable!Object



146
147
148
149
150
151
152
153
# File 'lib/httpx/adapters/webmock.rb', line 146

def enable!
  @original_session ||= HTTPX::Session

  webmock_session = HTTPX.plugin(Plugin)

  HTTPX.send(:remove_const, :Session)
  HTTPX.send(:const_set, :Session, webmock_session.class)
end