def self.stub_typhoeus(request_signature, webmock_response, typhoeus)
response = if webmock_response.should_timeout
::Typhoeus::Response.new(
:code => 0,
:status_message => "",
:body => "",
:headers_hash => {}
)
else
::Typhoeus::Response.new(
:code => webmock_response.status[0],
:status_message => webmock_response.status[1],
:body => webmock_response.body,
:headers_hash => webmock_response.headers
)
end
typhoeus.stub(
request_signature.method || :any,
/.*/,
:webmock_stub => true
).and_return(response)
end