trying to mock out requests to google maps api

191 views
Skip to first unread message

Brams

unread,
Nov 5, 2011, 7:14:47 PM11/5/11
to FakeWeb
I try to mock out geocoding request by using FakeWeb (in cucumber/
rails).

When I block all http requests I get the message:
Real HTTP connections are disabled. Unregistered request: GET
http://maps.google.com/maps/api/geocode/json?.....
(FakeWeb::NetConnectNotAllowedError)

So I registered the url by trying:
FakeWeb.register_uri(:any, %r|http://maps\.google\.com/maps/|, :json
=> {
"status": "OK",
....}

I get an error A JSON text must at least contain two octets!
(MultiJson::DecodeError)

I'm not sure what information to return. And how FakeWeb can return
json data..

I hope someone can help.

Thx

Douglas Camata

unread,
Sep 11, 2012, 8:32:28 PM9/11/12
to fakewe...@googlegroups.com, bramden...@gmail.com
Maybe you should try it like this:

FakeWeb.register_uri("blabla", body: {status: "OK"}.to_json)
Reply all
Reply to author
Forward
0 new messages