From 078733d22dca783c9b3519d2475605fbb9b60a9d Mon Sep 17 00:00:00 2001
From: Alex Reisner <alex@alexreisner.com>
Date: Tue, 31 Jan 2017 12:50:31 -0500
Subject: [PATCH] Add test to catch regression in v1.4.1.

---
 test/unit/calculations_test.rb | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/test/unit/calculations_test.rb b/test/unit/calculations_test.rb
index 02549d8a..9043001d 100644
--- a/test/unit/calculations_test.rb
+++ b/test/unit/calculations_test.rb
@@ -161,14 +161,21 @@ class CalculationsTest < GeocoderTestCase
     assert_equal l.bearing_from([50,-86.1]), l.bearing_to([50,-86.1]) - 180
   end
 
-  def test_extract_coordinates
-    coords = [-23,47]
+  def test_extract_coordinates_when_integers
+    coords = [-23, 47]
     l = PlaceReverseGeocoded.new("Madagascar", coords[0], coords[1])
-    assert_equal coords, Geocoder::Calculations.extract_coordinates(l)
-    assert_equal coords, Geocoder::Calculations.extract_coordinates(coords)
+    assert_equal coords.map(&:to_f), Geocoder::Calculations.extract_coordinates(l)
+    assert_equal coords.map(&:to_f), Geocoder::Calculations.extract_coordinates(coords)
   end
 
-  def test_extract_nan_coordinates
+  def test_extract_coordinates_when_strings
+    coords = ["-23.1", "47.2"]
+    l = PlaceReverseGeocoded.new("Madagascar", coords[0], coords[1])
+    assert_equal coords.map(&:to_f), Geocoder::Calculations.extract_coordinates(l)
+    assert_equal coords.map(&:to_f), Geocoder::Calculations.extract_coordinates(coords)
+  end
+
+  def test_extract_coordinates_when_nan
     result = Geocoder::Calculations.extract_coordinates([ nil, nil ])
     assert_nan_coordinates?(result)
 
-- 
GitLab