Skip to content
Snippets Groups Projects
Commit 59c303cd authored by Alex Reisner's avatar Alex Reisner Committed by GitHub
Browse files

Merge pull request #1011 from mltsy/master

Make geocoded? return false with single coordinate
parents f9eede12 5ff7d0c0
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,7 @@ module Geocoder ...@@ -6,7 +6,7 @@ module Geocoder
# Is this object geocoded? (Does it have latitude and longitude?) # Is this object geocoded? (Does it have latitude and longitude?)
# #
def geocoded? def geocoded?
to_coordinates.compact.size > 0 to_coordinates.compact.size == 2
end end
## ##
......
...@@ -8,6 +8,12 @@ class MongoidTest < GeocoderTestCase ...@@ -8,6 +8,12 @@ class MongoidTest < GeocoderTestCase
assert p.geocoded? assert p.geocoded?
end end
def test_geocoded_check_single_coord
p = PlaceUsingMongoid.new(*geocoded_object_params(:msg))
p.location = [40.750354, nil]
assert !p.geocoded?
end
def test_distance_to_returns_float def test_distance_to_returns_float
p = PlaceUsingMongoid.new(*geocoded_object_params(:msg)) p = PlaceUsingMongoid.new(*geocoded_object_params(:msg))
p.location = [40.750354, -73.993371] p.location = [40.750354, -73.993371]
......
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