0

I am working on a ruby application that uses the geocoder gem to generate location information from addresses. I am trying to use webmock to stub out calls to the api during testing.

Webmock has the option of creating a mock response from a file and has an explanation of how to replay responses recorded with curl -is

https://github.com/bblimke/webmock#replaying-raw-responses-recorded-with-curl--is

I have previously got this to work with different urls but not when trying with the following command.

curl -is http://maps.googleapis.com/maps/api/geocode/json?address=Falmouth,%20Cornwall&language=en&sensor=false > other.txt

When I run the above command all the data I want is outputted to the terminal correctly but nothing at all written to file. I have tried with the --no-keepalive option but that does not fix it

Peter Saxton
  • 4,466
  • 5
  • 33
  • 51

1 Answers1

0

The example in the webmock readme uses I/O re-direction to write the result to a text file. Is that what you are missing? So shouldn't your curl command looks like:

curl -is http://maps.googleapis.com/maps/api/geocode/json?address=Falmouth,%20Cornwall > my_text_file.txt ?

ivan.sim
  • 8,972
  • 8
  • 47
  • 63
  • sorry I have copied that wrong. Yes I have been using redirection – Peter Saxton Aug 12 '14 at 06:04
  • I copied yours and it worked for me. turns out what I was typing in was `curl -is http://maps.googleapis.com/maps/api/geocode/json?address=Falmouth,%20Cornwall&language=en&sensor=false >other.txt` I had been copying what was returned from the terminal. so I assume it is something to do with sensor=false – Peter Saxton Aug 12 '14 at 06:38
  • Looks like the `sensor` parameter is no longer required. https://developers.google.com/maps/articles/geolocation – ivan.sim Aug 12 '14 at 06:57