diff --git a/lib/geocoder/query.rb b/lib/geocoder/query.rb index c8d2a67a0..c509a7bfb 100644 --- a/lib/geocoder/query.rb +++ b/lib/geocoder/query.rb @@ -23,7 +23,7 @@ def sanitized_text text.split(/\s*,\s*/).join(',') end else - text.strip + text.to_s.strip end end diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb index ac3a313a1..27a35172b 100644 --- a/test/unit/query_test.rb +++ b/test/unit/query_test.rb @@ -5,10 +5,14 @@ class QueryTest < GeocoderTestCase def test_detect_ipv4 assert Geocoder::Query.new("232.65.123.94").ip_address? + ip = IPAddr.new("232.65.123.94") + assert Geocoder::Query.new(ip).ip_address? end def test_detect_ipv6 assert Geocoder::Query.new("3ffe:0b00:0000:0000:0001:0000:0000:000a").ip_address? + ip = IPAddr.new("3ffe:0b00:0000:0000:0001:0000:0000:000a") + assert Geocoder::Query.new(ip).ip_address? end def test_detect_non_ip_address