Deflate Curl :: Easy.perform? (in curb)

Is there a way to weary out the Curb Easy.perform method for unit testing? I use this to use the Facebook GUI API, and none of the HTTP mock libraries seem to support Curb.

What is the best approach here?

+4
source share
2 answers

WebMock recently added support for Curb. :)

http://github.com/bblimke/webmock

+3
source

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 
0
source

All Articles