Since you did not specify your test structure, I will give a specific answer.
I use Cucumber and Rspec. Although all of the above is true from @DevDude and @malandrina, here is a more complete tip on which code can go, and how to add entries for reverse geocoding (lat / lon β address):
Put your stubs in the spec folder. I created an array of arrays so that I can add some βlookupsβ that need to be flashed:
spec/support/geocoder_stubs.rb addresses = { "230 West 43rd St., New York City, NY 10036" => { 'latitude' => 40.7573862, 'longitude' => -73.9881256, 'address' => '230 West 43rd St., New York City, NY 10036', 'city' => 'New York City', 'state' => 'New York', 'state_code' => 'NY', 'country' => 'United States', 'country_code' => 'US' }, [40.75747130000001, -73.9877319] => { 'latitude' => 40.75747130000001, 'longitude' => -73.9877319, 'address' => '229 West 43rd St., New York City, NY 10036', 'city' => 'New York City', 'state' => 'New York', 'state_code' => 'NY', 'country' => 'United States', 'country_code' => 'US' }, "Worthington, OH" => { 'latitude' => 40.09846115112305, 'longitude' => -83.01747131347656, 'address' => 'Worthington, OH', 'city' => 'Worthington', 'state' => 'Ohio', 'state_code' => 'OH', 'country' => 'United States', 'country_code' => 'US' }, } Geocoder.configure(:lookup => :test) addresses.each { |lookup, results| Geocoder::Lookup::Test.add_stub(lookup, [results]) }
Link to your stubs in the cucumber support folder:
features/support/env.rb require Rails.root.join("spec/support/geocoder_stubs")
Hope this helps!