Sha256: 2a3d814c3f66fe809b2a255fb74850e754786b9e8ef4e7f425a91a93a681c9d9
Contents?: true
Size: 844 Bytes
Versions: 10
Compression:
Stored size: 844 Bytes
Contents
# Copyright (c) 2011 Evan Phoenix # Copyright (c) 2005 Zed A. Shaw %w(lib ext bin test).each do |dir| $LOAD_PATH.unshift File.expand_path("../../#{dir}", __FILE__) end require 'rubygems' require 'test/unit' require 'net/http' require 'digest/sha1' require 'uri' require 'stringio' require 'puma' def redirect_test_io yield end # Either takes a string to do a get request against, or a tuple of [URI, HTTP] where # HTTP is some kind of Net::HTTP request object (POST, HEAD, etc.) def hit(uris) results = [] uris.each do |u| res = nil if u.kind_of? String res = Net::HTTP.get(URI.parse(u)) else url = URI.parse(u[0]) res = Net::HTTP.new(url.host, url.port).start {|h| h.request(u[1]) } end assert res != nil, "Didn't get a response: #{u}" results << res end return results end
Version data entries
10 entries across 10 versions & 1 rubygems