Module: VCR::LibraryHooks::WebMock

Extended by:
WebMock, Helpers
Included in:
WebMock
Defined in:
lib/vcr/library_hooks/webmock.rb

Defined Under Namespace

Modules: Helpers Classes: RequestHandler

Instance Method Summary collapse

Methods included from Helpers

request_headers_for, typed_request_for, vcr_request_for, vcr_response_for

Instance Method Details

#global_hook_disabled?(request) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
28
# File 'lib/vcr/library_hooks/webmock.rb', line 25

def global_hook_disabled?(request)
  requests = Thread.current[:_vcr_webmock_disabled_requests]
  requests && requests.include?(request)
end

#global_hook_disabled_requestsObject



30
31
32
# File 'lib/vcr/library_hooks/webmock.rb', line 30

def global_hook_disabled_requests
  Thread.current[:_vcr_webmock_disabled_requests] ||= []
end

#with_global_hook_disabled(request) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/vcr/library_hooks/webmock.rb', line 15

def with_global_hook_disabled(request)
  global_hook_disabled_requests << request

  begin
    yield
  ensure
    global_hook_disabled_requests.delete(request)
  end
end