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



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

def disable!
  return unless @original_session

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

.enable!Object



140
141
142
143
144
145
146
147
# File 'lib/httpx/adapters/webmock.rb', line 140

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