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

Merge pull request #843 from TrangPham/silence-warnings

Silence warnings using silence_warnings blocks
parents 293c6e8f ede5cd42
No related branches found
No related tags found
No related merge requests found
...@@ -40,6 +40,8 @@ class LoggerTest < GeocoderTestCase ...@@ -40,6 +40,8 @@ class LoggerTest < GeocoderTestCase
def test_kernel_logger_always_returns_nil def test_kernel_logger_always_returns_nil
Geocoder.configure(logger: :kernel) 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
end end
...@@ -12,11 +12,13 @@ class LookupTest < GeocoderTestCase ...@@ -12,11 +12,13 @@ class LookupTest < GeocoderTestCase
end end
def test_search_returns_empty_array_when_no_results def test_search_returns_empty_array_when_no_results
Geocoder::Lookup.all_services_except_test.each do |l| silence_warnings do
lookup = Geocoder::Lookup.get(l) Geocoder::Lookup.all_services_except_test.each do |l|
set_api_key!(l) lookup = Geocoder::Lookup.get(l)
assert_equal [], lookup.send(:results, Geocoder::Query.new("no results")), set_api_key!(l)
"Lookup #{l} does not return empty array when no results." assert_equal [], lookup.send(:results, Geocoder::Query.new("no results")),
"Lookup #{l} does not return empty array when no results."
end
end end
end end
......
...@@ -90,7 +90,9 @@ class GooglePlacesDetailsTest < GeocoderTestCase ...@@ -90,7 +90,9 @@ class GooglePlacesDetailsTest < GeocoderTestCase
end end
def test_google_places_details_result_with_invalid_place_id_empty 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 end
def test_raises_exception_on_google_places_details_invalid_request def test_raises_exception_on_google_places_details_invalid_request
......
...@@ -18,12 +18,16 @@ class PointpinTest < GeocoderTestCase ...@@ -18,12 +18,16 @@ class PointpinTest < GeocoderTestCase
end end
def test_no_results def test_no_results
results = Geocoder.search("10.10.10.10") silence_warnings do
assert_equal 0, results.length results = Geocoder.search("10.10.10.10")
assert_equal 0, results.length
end
end end
def test_invalid_address def test_invalid_address
results = Geocoder.search("555.555.555.555", ip_address: true) silence_warnings do
assert_equal 0, results.length results = Geocoder.search("555.555.555.555", ip_address: true)
assert_equal 0, results.length
end
end end
end end
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