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



132
133
134
135
136
137
# File 'lib/httpx/adapters/webmock.rb', line 132

def disable!
  return unless @original_session

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

.enable!Object



123
124
125
126
127
128
129
130
# File 'lib/httpx/adapters/webmock.rb', line 123

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