mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-11-30 00:00:45 -05:00
Merge branch 'fix-webmock-adapter-enable-disable-issue' into 'master'
Fix WebMock adapter so that it gets disabled when WebMock gets disabled See merge request os85/httpx!247
This commit is contained in:
commit
8db1557827
@ -204,6 +204,16 @@ class WebmockTest < Minitest::Test
|
|||||||
WebMock.disable_net_connect!
|
WebMock.disable_net_connect!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_webmock_disable_after_enable
|
||||||
|
WebMock.disable!
|
||||||
|
|
||||||
|
# WebMock is disabled so this will make a real http request
|
||||||
|
http_request(:get, "http://#{httpbin}")
|
||||||
|
|
||||||
|
# WebMock is disabled so it should not have registered the request
|
||||||
|
assert_not_requested(:get, "http://#{httpbin}")
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def assert_raise_with_message(e, message, &block)
|
def assert_raise_with_message(e, message, &block)
|
||||||
|
|||||||
@ -122,7 +122,7 @@ module WebMock
|
|||||||
|
|
||||||
class << self
|
class << self
|
||||||
def enable!
|
def enable!
|
||||||
@original_session = HTTPX::Session
|
@original_session ||= HTTPX::Session
|
||||||
|
|
||||||
webmock_session = HTTPX.plugin(Plugin)
|
webmock_session = HTTPX.plugin(Plugin)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user