diff --git a/test/unit/logger_test.rb b/test/unit/logger_test.rb index 41a84fc423a40a0cb0e3d39a54a8c0ef8916b80b..c6cf7f64c380ba42ae699fb562e62014469e555d 100644 --- a/test/unit/logger_test.rb +++ b/test/unit/logger_test.rb @@ -40,6 +40,8 @@ class LoggerTest < GeocoderTestCase def test_kernel_logger_always_returns_nil Geocoder.configure(logger: :kernel) - assert_equal nil, Geocoder.log(:info, "should log") + silence_warnings do + assert_equal nil, Geocoder.log(:warn, "should log") + end end end diff --git a/test/unit/lookup_test.rb b/test/unit/lookup_test.rb index 56152c220b5c59e3db0a17a86ae1c59b5763b0dd..393a42bb8177dbf3a61aff570b6db7dc13cacdaf 100644 --- a/test/unit/lookup_test.rb +++ b/test/unit/lookup_test.rb @@ -12,11 +12,13 @@ class LookupTest < GeocoderTestCase end def test_search_returns_empty_array_when_no_results - Geocoder::Lookup.all_services_except_test.each do |l| - lookup = Geocoder::Lookup.get(l) - set_api_key!(l) - assert_equal [], lookup.send(:results, Geocoder::Query.new("no results")), - "Lookup #{l} does not return empty array when no results." + silence_warnings do + Geocoder::Lookup.all_services_except_test.each do |l| + lookup = Geocoder::Lookup.get(l) + set_api_key!(l) + assert_equal [], lookup.send(:results, Geocoder::Query.new("no results")), + "Lookup #{l} does not return empty array when no results." + end end end diff --git a/test/unit/lookups/google_places_details_test.rb b/test/unit/lookups/google_places_details_test.rb index acbd01b0de70f3ddef244e7748a7bb19e17907d7..e236e04155be5ce732b5628e93d72d79fc5a07b5 100644 --- a/test/unit/lookups/google_places_details_test.rb +++ b/test/unit/lookups/google_places_details_test.rb @@ -90,7 +90,9 @@ class GooglePlacesDetailsTest < GeocoderTestCase end def test_google_places_details_result_with_invalid_place_id_empty - assert_equal Geocoder.search("invalid request"), [] + silence_warnings do + assert_equal Geocoder.search("invalid request"), [] + end end def test_raises_exception_on_google_places_details_invalid_request diff --git a/test/unit/lookups/pointpin_test.rb b/test/unit/lookups/pointpin_test.rb index 308a149af2aa26df18f01f657e64d249d06f6c85..86549e994eb2c11ffde9bb443392abb5badc6ea5 100644 --- a/test/unit/lookups/pointpin_test.rb +++ b/test/unit/lookups/pointpin_test.rb @@ -18,12 +18,16 @@ class PointpinTest < GeocoderTestCase end def test_no_results - results = Geocoder.search("10.10.10.10") - assert_equal 0, results.length + silence_warnings do + results = Geocoder.search("10.10.10.10") + assert_equal 0, results.length + end end def test_invalid_address - results = Geocoder.search("555.555.555.555", ip_address: true) - assert_equal 0, results.length + silence_warnings do + results = Geocoder.search("555.555.555.555", ip_address: true) + assert_equal 0, results.length + end end end