diff --git a/test/unit/calculations_test.rb b/test/unit/calculations_test.rb index 83b0faf39860b29f18efaa6032458f60d10adf44..6b3bc8d262a8c3894268cd5f1088c86c1c694a3d 100644 --- a/test/unit/calculations_test.rb +++ b/test/unit/calculations_test.rb @@ -67,8 +67,6 @@ class CalculationsTest < GeocoderTestCase def test_bounding_box_calculation_in_miles center = [51, 7] # Cologne, DE radius = 10 # miles - dlon = radius / Geocoder::Calculations.latitude_degree_distance - dlat = radius / Geocoder::Calculations.longitude_degree_distance(center[0]) corners = [50.86, 6.77, 51.14, 7.23] assert_equal corners.map{ |i| (i * 100).round }, Geocoder::Calculations.bounding_box(center, radius).map{ |i| (i * 100).round } @@ -77,8 +75,6 @@ class CalculationsTest < GeocoderTestCase def test_bounding_box_calculation_in_kilometers center = [51, 7] # Cologne, DE radius = 111 # kilometers (= 1 degree latitude) - dlon = radius / Geocoder::Calculations.latitude_degree_distance(:km) - dlat = radius / Geocoder::Calculations.longitude_degree_distance(center[0], :km) corners = [50, 5.41, 52, 8.59] assert_equal corners.map{ |i| (i * 100).round }, Geocoder::Calculations.bounding_box(center, radius, :units => :km).map{ |i| (i * 100).round } @@ -87,8 +83,6 @@ class CalculationsTest < GeocoderTestCase def test_bounding_box_calculation_with_object center = [51, 7] # Cologne, DE radius = 10 # miles - dlon = radius / Geocoder::Calculations.latitude_degree_distance - dlat = radius / Geocoder::Calculations.longitude_degree_distance(center[0]) corners = [50.86, 6.77, 51.14, 7.23] obj = PlaceReverseGeocoded.new("Cologne", center[0], center[1]) assert_equal corners.map{ |i| (i * 100).round }, diff --git a/test/unit/lookup_test.rb b/test/unit/lookup_test.rb index 6512c8e1b5965b3284df5f20a60bf3fa6e23b579..c4bc3649ab8dade5a93dd98fc237df570bd3e2cb 100644 --- a/test/unit/lookup_test.rb +++ b/test/unit/lookup_test.rb @@ -29,8 +29,8 @@ class LookupTest < GeocoderTestCase "test", :params => {:one_in_the_hand => "two in the bush"} )) # should be "+"s for all lookups except Yahoo - assert_match /one_in_the_hand=two(%20|\+)in(%20|\+)the(%20|\+)bush/, url, - "Lookup #{l} does not appear to support arbitrary params in URL" + assert_match(/one_in_the_hand=two(%20|\+)in(%20|\+)the(%20|\+)bush/, url, + "Lookup #{l} does not appear to support arbitrary params in URL") end end @@ -51,8 +51,8 @@ class LookupTest < GeocoderTestCase url = Geocoder::Lookup.get(l).query_url(Geocoder::Query.new( "test", :params => {p => "xxxx"} )) - assert_match /#{p}=xxxx/, url, - "Param passed to #{l} lookup does not override configuration value" + assert_match(/#{p}=xxxx/, url, + "Param passed to #{l} lookup does not override configuration value") end end diff --git a/test/unit/lookups/bing_test.rb b/test/unit/lookups/bing_test.rb index 864bc8ac80868afe174084be23179c72d2f5be0f..3fe765a4b3b5770f2003be1de7680bbaef768a0d 100644 --- a/test/unit/lookups/bing_test.rb +++ b/test/unit/lookups/bing_test.rb @@ -12,7 +12,7 @@ class BingTest < GeocoderTestCase def test_query_for_reverse_geocode lookup = Geocoder::Lookup::Bing.new url = lookup.query_url(Geocoder::Query.new([45.423733, -75.676333])) - assert_match /Locations\/45.423733/, url + assert_match(/Locations\/45.423733/, url) end def test_result_components @@ -33,8 +33,8 @@ class BingTest < GeocoderTestCase "manchester", :region => "uk" )) - assert_match /Locations\/uk\/manchester/, url - assert_no_match /query/, url + assert_match(/Locations\/uk\/manchester/, url) + assert_no_match(/query/, url) end def test_query_url_without_region @@ -42,8 +42,8 @@ class BingTest < GeocoderTestCase url = lookup.query_url(Geocoder::Query.new( "manchester" )) - assert_match /Locations\/manchester/, url - assert_no_match /query/, url + assert_match(/Locations\/manchester/, url) + assert_no_match(/query/, url) end def test_query_url_contains_address_with_spaces @@ -52,8 +52,8 @@ class BingTest < GeocoderTestCase "manchester, lancashire", :region => "uk" )) - assert_match /Locations\/uk\/manchester,%20lancashire/, url - assert_no_match /query/, url + assert_match(/Locations\/uk\/manchester,%20lancashire/, url) + assert_no_match(/query/, url) end def test_query_url_contains_address_with_trailing_and_leading_spaces @@ -62,7 +62,7 @@ class BingTest < GeocoderTestCase " manchester, lancashire ", :region => "uk" )) - assert_match /Locations\/uk\/manchester,%20lancashire/, url - assert_no_match /query/, url + assert_match(/Locations\/uk\/manchester,%20lancashire/, url) + assert_no_match(/query/, url) end end diff --git a/test/unit/lookups/esri_test.rb b/test/unit/lookups/esri_test.rb index 625fff7dc90f8f2d1df3e7125d570ba4e2f81f9e..639685f7232d06434bf4c01349cae1ac25b52add 100644 --- a/test/unit/lookups/esri_test.rb +++ b/test/unit/lookups/esri_test.rb @@ -31,8 +31,8 @@ class EsriTest < GeocoderTestCase assert_equal "Madison Square Garden", result.address assert_equal "New York", result.city assert_equal "New York", result.state - assert_equal 40.75004981300049, result.coordinates[0] - assert_equal -73.99423889799965, result.coordinates[1] + assert_equal(40.75004981300049, result.coordinates[0]) + assert_equal(-73.99423889799965, result.coordinates[1]) end def test_results_component_when_reverse_geocoding @@ -42,7 +42,7 @@ class EsriTest < GeocoderTestCase assert_equal "4 Avenue Gustave Eiffel", result.address assert_equal "Paris", result.city assert_equal "ÃŽle-de-France", result.state - assert_equal 48.858129997357558, result.coordinates[0] - assert_equal 2.2956200048981574, result.coordinates[1] + assert_equal(48.858129997357558, result.coordinates[0]) + assert_equal(2.2956200048981574, result.coordinates[1]) end end diff --git a/test/unit/lookups/google_test.rb b/test/unit/lookups/google_test.rb index 35960a5151d50d4e397cfeabc888fa7df1096742..ad6aec222b7cd4af0327f950c9ddb5bd11b5d5d7 100644 --- a/test/unit/lookups/google_test.rb +++ b/test/unit/lookups/google_test.rb @@ -49,7 +49,7 @@ class GoogleTest < GeocoderTestCase "Some Intersection", :bounds => [[40.0, -120.0], [39.0, -121.0]] )) - assert_match /bounds=40.0+%2C-120.0+%7C39.0+%2C-121.0+/, url + assert_match(/bounds=40.0+%2C-120.0+%7C39.0+%2C-121.0+/, url) end def test_google_query_url_contains_region @@ -58,7 +58,7 @@ class GoogleTest < GeocoderTestCase "Some Intersection", :region => "gb" )) - assert_match /region=gb/, url + assert_match(/region=gb/, url) end def test_google_query_url_contains_components_when_given_as_string diff --git a/test/unit/lookups/mapquest_test.rb b/test/unit/lookups/mapquest_test.rb index 1f6b22b14a6a71d6dd1a40033d2f233eb134c97d..a8e751a4aed11659cf7a8025665d32b7f0c5d50e 100644 --- a/test/unit/lookups/mapquest_test.rb +++ b/test/unit/lookups/mapquest_test.rb @@ -11,21 +11,18 @@ class MapquestTest < GeocoderTestCase def test_url_contains_api_key Geocoder.configure(mapquest: {api_key: "abc123"}) - lookup = Geocoder::Lookup::Mapquest.new query = Geocoder::Query.new("Bluffton, SC") assert_equal "http://www.mapquestapi.com/geocoding/v1/address?key=abc123&location=Bluffton%2C+SC", query.url end def test_url_for_version_2 Geocoder.configure(mapquest: {api_key: "abc123", version: 2}) - lookup = Geocoder::Lookup::Mapquest.new query = Geocoder::Query.new("Bluffton, SC") assert_equal "http://www.mapquestapi.com/geocoding/v2/address?key=abc123&location=Bluffton%2C+SC", query.url end def test_url_for_open_street_maps Geocoder.configure(mapquest: {api_key: "abc123", open: true}) - lookup = Geocoder::Lookup::Mapquest.new query = Geocoder::Query.new("Bluffton, SC") assert_equal "http://open.mapquestapi.com/geocoding/v1/address?key=abc123&location=Bluffton%2C+SC", query.url end diff --git a/test/unit/lookups/nominatim_test.rb b/test/unit/lookups/nominatim_test.rb index 067a46e32d59198987f450edc663661a7a8047d3..246dd54dfd75b805149aa2e6b194c772ed58472e 100644 --- a/test/unit/lookups/nominatim_test.rb +++ b/test/unit/lookups/nominatim_test.rb @@ -17,7 +17,6 @@ class NominatimTest < GeocoderTestCase def test_host_configuration Geocoder.configure(nominatim: {host: "local.com"}) - lookup = Geocoder::Lookup::Nominatim.new query = Geocoder::Query.new("Bluffton, SC") assert_match %r(http://local\.com), query.url end diff --git a/test/unit/oauth_util_test.rb b/test/unit/oauth_util_test.rb index 2fa2dc6db983b1f6e2aca16292f36c928854e2ad..e3384031b2f5057dcf4ec5bd7490c6394b611b9e 100644 --- a/test/unit/oauth_util_test.rb +++ b/test/unit/oauth_util_test.rb @@ -26,6 +26,6 @@ class OauthUtilTest < GeocoderTestCase query_string = o.sign(URI.parse(base_url)).query_string - assert_match /.*a_param=.*b_param=.*n_param=.*z_param=.*/, query_string + assert_match(/.*a_param=.*b_param=.*n_param=.*z_param=.*/, query_string) end end