class VCR::LibraryHooks::WebMock::RequestHandler

Attributes

request[R]

Public Class Methods

new(request) click to toggle source
# File lib/vcr/library_hooks/webmock.rb, line 83
def initialize(request)
  @request = request
end

Private Instance Methods

externally_stubbed?() click to toggle source
# File lib/vcr/library_hooks/webmock.rb, line 89
def externally_stubbed?
  # prevent infinite recursion...
  VCR::LibraryHooks::WebMock.with_global_hook_disabled do
    ::WebMock.registered_request?(request)
  end
end
on_externally_stubbed_request() click to toggle source
# File lib/vcr/library_hooks/webmock.rb, line 105
def on_externally_stubbed_request
  # nil allows WebMock to handle the request
  nil
end
on_stubbed_by_vcr_request() click to toggle source
# File lib/vcr/library_hooks/webmock.rb, line 115
def on_stubbed_by_vcr_request
  {
    :body    => stubbed_response.body,
    :status  => [stubbed_response.status.code.to_i, stubbed_response.status.message],
    :headers => stubbed_response.headers
  }
end
on_unhandled_request() click to toggle source
# File lib/vcr/library_hooks/webmock.rb, line 110
def on_unhandled_request
  invoke_after_request_hook(nil)
  super
end
set_typed_request_for_after_hook(*args) click to toggle source
# File lib/vcr/library_hooks/webmock.rb, line 96
def set_typed_request_for_after_hook(*args)
  super
  request.instance_variable_set(:@__typed_vcr_request, @after_hook_typed_request)
end
vcr_request() click to toggle source
# File lib/vcr/library_hooks/webmock.rb, line 101
def vcr_request
  @vcr_request ||= vcr_request_for(request)
end