Skip to content
Snippets Groups Projects
Commit 409df9e3 authored by Alex Reisner's avatar Alex Reisner
Browse files

Merge pull request #349 from spaghetticode/master

add #route to google result parser
parents da364196 be613759
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