Sha256: 371bd0c57fbcc5b7e8e2f80f460c695139d2505382ee1d3b61fc04ded0fe903e
Contents?: true
Size: 967 Bytes
Versions: 4
Compression:
Stored size: 967 Bytes
Contents
# Copyright (c) 2005 Zed A. Shaw # You can redistribute it and/or modify it under the same terms as Ruby. # # Additional work donated by contributors. See http://mongrel.rubyforge.org/attributions.html # for more information. def redirect_test_io orig_err = STDERR.dup orig_out = STDOUT.dup STDERR.reopen("test_stderr.log") STDOUT.reopen("test_stdout.log") begin yield ensure STDERR.reopen(orig_err) STDOUT.reopen(orig_out) end 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
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
mongrel-0.3.13.3 | test/testhelp.rb |
mongrel-0.3.13.4 | test/testhelp.rb |
mongrel-1.0.1 | test/testhelp.rb |
mongrel-1.0 | test/testhelp.rb |