module VCR::HttpStubbingAdapters::Typhoeus

Constants

MAXIMUM_VERSION
MINIMUM_VERSION

Public Instance Methods

create_stubs_checkpoint(cassette) click to toggle source
# File lib/vcr/http_stubbing_adapters/typhoeus.rb, line 42
def create_stubs_checkpoint(cassette)
  checkpoints[cassette] = ::Typhoeus::Hydra.stubs.dup
end
http_connections_allowed=(value) click to toggle source
# File lib/vcr/http_stubbing_adapters/typhoeus.rb, line 12
def http_connections_allowed=(value)
  ::Typhoeus::Hydra.allow_net_connect = value
end
http_connections_allowed?() click to toggle source
# File lib/vcr/http_stubbing_adapters/typhoeus.rb, line 16
def http_connections_allowed?
  !!::Typhoeus::Hydra.allow_net_connect?
end
ignored_hosts=(hosts) click to toggle source
# File lib/vcr/http_stubbing_adapters/typhoeus.rb, line 20
def ignored_hosts=(hosts)
  ::Typhoeus::Hydra.ignore_hosts = hosts
end
restore_stubs_checkpoint(cassette) click to toggle source
# File lib/vcr/http_stubbing_adapters/typhoeus.rb, line 46
def restore_stubs_checkpoint(cassette)
  ::Typhoeus::Hydra.stubs = checkpoints.delete(cassette) || super
end
stub_requests(http_interactions, match_attributes) click to toggle source
# File lib/vcr/http_stubbing_adapters/typhoeus.rb, line 24
def stub_requests(http_interactions, match_attributes)
  grouped_responses(http_interactions, match_attributes).each do |request_matcher, responses|
    ::Typhoeus::Hydra.stub(
      request_matcher.method || :any,
      request_matcher.uri,
      request_hash(request_matcher)
    ).and_return(
      responses.map do |response|
        ::Typhoeus::Response.new(
          :code         => response.status.code,
          :body         => response.body,
          :headers_hash => normalized_response_headers(response)
        )
      end
    )
  end
end