I really think fakeWeb is a great way to trick network calls; Regardless of the HTTP library used, you simply specify which response text and code you want to receive.
It is described as:
FakeWeb is a helper for faking website requests in Ruby. It works globally, without changing the code or writing extensive stubs
Example from the github repository :
FakeWeb.register_uri(:get, "http://example.com/test1", :string => "Hello World!") Net::HTTP.get(URI.parse("http://example.com/test1")) => "Hello World!" Net::HTTP.get(URI.parse("http://example.com/test2")) => FakeWeb is bypassed and the response from a real request is returned
source share