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

Add distance_from as alias for distance_to.

parent 6459753b
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,8 @@ module Geocoder
Geocoder::Calculations.distance_between(mylat, mylon, lat, lon, :units => units)
end
alias_method :distance_from, :distance_to
##
# Get other geocoded objects within a given radius.
#
......
......@@ -57,6 +57,15 @@ class GeocoderTest < Test::Unit::TestCase
assert_equal "US", e.country
end
def test_distance_to_returns_float
v = Venue.new(*venue_params(:msg))
v.latitude = 40.750354
v.longitude = -73.993371
assert (d = v.distance_to(30, -94)).is_a?(Float)
# make sure distance_from is an alias
assert_equal d, v.distance_from(30, -94)
end
# --- Google ---
......
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