Skip to content
Snippets Groups Projects
Commit be613759 authored by andrea longhi's avatar andrea longhi
Browse files

add route info for google result

parent da364196
No related branches found
No related tags found
No related merge requests found
......@@ -53,6 +53,12 @@ module Geocoder::Result
end
end
def route
if route = address_components_of_type(:route).first
route['long_name']
end
end
def types
@data['types']
end
......
......@@ -25,6 +25,12 @@ class ServicesTest < Test::Unit::TestCase
result.address_components_of_type(:sublocality).first['long_name']
end
def test_google_result_components_contains_route
result = Geocoder.search("Madison Square Garden, New York, NY").first
assert_equal "Penn Plaza",
result.address_components_of_type(:route).first['long_name']
end
def test_google_returns_city_when_no_locality_in_result
result = Geocoder.search("no locality").first
assert_equal "Haram", result.city
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment