[ANN] FakeWeb test helper for Net::HTTP / open-uri web requests

R

romeda

Hey All,

I've posted the first release of FakeWeb, a little library to help
with all your http client testing needs. This helper makes it trivial
to setup an idempodent environment for you to test any web service
requests in your applications.

Available on RubyForge, http://rubyforge.org/projects/fakeweb/

== Overview
* Force Net::HTTP (and any dependent libraries, e.g. open-uri) to
return arbitrary responses or exceptions for a given set of request
URLs.
* Speed up tests that involve remote HTTP round trips.
* 100% C0 test coverage as reported by rcov
* Works for all regular HTTP requests, as well as Proxied and HTTPS
requests.

== Two-line Example
FakeWeb.register_uri("http://example.com/", :string => "Hello World")
open("http://example.com/").string # => "Hello World"

== Another Example
FakeWeb.register_uri("http://example.com/",
:response => `curl -i
http://www.google.com/`)
Net::HTTP.get_response("example.com", "/")
# => Net::HTTPResponse equivalent to fetching http://www.google.com/

Versions 1.0.0 and 1.1.0 are available, the former works with Ruby
1.8.2, and the latter (and all subsequent releases) works with Ruby
1.8.4.

See http://fakeweb.rubyforge.org/ for more information and
documentation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,479
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top