File tree Expand file tree Collapse file tree
lib/webmock/http_lib_adapters Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -54,7 +54,6 @@ def self.parse_header_string(header_string)
5454
5555 module Curl
5656 class WebMockCurlEasy < Curl ::Easy
57-
5857 def curb_or_webmock
5958 request_signature = build_request_signature
6059 WebMock ::RequestRegistry . instance . requested_signatures . put ( request_signature )
@@ -271,6 +270,8 @@ def http_post *data
271270 def perform
272271 @webmock_method ||= :get
273272 curb_or_webmock { super }
273+ ensure
274+ reset_webmock_method
274275 end
275276
276277 def put_data = data
@@ -333,6 +334,10 @@ def on_#{callback} &block
333334 METHOD
334335 end
335336
337+ def reset_webmock_method
338+ @webmock_method = :get
339+ end
340+
336341 def reset
337342 instance_variable_set ( :@body_str , nil )
338343 super
Original file line number Diff line number Diff line change 411411 it_should_behave_like "Curb"
412412 include CurbSpecHelper ::NamedHttp
413413
414+ it "should reset @webmock_method after each call" do
415+ stub_request ( :post , "www.example.com" ) . with ( body : "01234" )
416+ c = Curl ::Easy . new
417+ c . url = "http://www.example.com"
418+ c . post_body = "01234"
419+ c . http_post
420+ expect {
421+ c . perform
422+ } . to raise_error ( WebMock ::NetConnectNotAllowedError , %r(Real HTTP connections are disabled. Unregistered request: GET http://www.example.com) )
423+ end
424+
414425 it "should work with blank arguments for post" do
415426 stub_request ( :post , "www.example.com" ) . with ( body : "01234" )
416427 c = Curl ::Easy . new
You can’t perform that action at this time.
0 commit comments