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

Use ActiveSupport's silence_warnings method.

parent 6646ecea
No related branches found
No related tags found
No related merge requests found
......@@ -9,15 +9,13 @@ class ErrorHandlingTest < GeocoderTestCase
end
def test_does_not_choke_on_timeout
# keep test output clean: suppress timeout warning
orig = $VERBOSE; $VERBOSE = nil
Geocoder::Lookup.all_services_except_test.each do |l|
Geocoder.configure(:lookup => l)
set_api_key!(l)
assert_nothing_raised { Geocoder.search("timeout") }
silence_warnings do
Geocoder::Lookup.all_services_except_test.each do |l|
Geocoder.configure(:lookup => l)
set_api_key!(l)
assert_nothing_raised { Geocoder.search("timeout") }
end
end
ensure
$VERBOSE = orig
end
def test_always_raise_timeout_error
......
......@@ -68,16 +68,14 @@ class LookupTest < GeocoderTestCase
end
def test_returns_empty_array_on_invalid_key
# keep test output clean: suppress timeout warning
orig = $VERBOSE; $VERBOSE = nil
#Geocoder::Lookup.all_services_except_test.each do |l|
[:bing, :yahoo, :yandex, :maxmind, :cloudmade, :baidu, :baidu_ip].each do |l|
Geocoder.configure(:lookup => l)
set_api_key!(l)
assert_equal [], Geocoder.search("invalid key")
silence_warnings do
#Geocoder::Lookup.all_services_except_test.each do |l|
[:bing, :yahoo, :yandex, :maxmind, :cloudmade, :baidu, :baidu_ip].each do |l|
Geocoder.configure(:lookup => l)
set_api_key!(l)
assert_equal [], Geocoder.search("invalid key")
end
end
ensure
$VERBOSE = orig
end
def test_does_not_choke_on_nil_address
......
......@@ -14,11 +14,9 @@ class YahooTest < GeocoderTestCase
end
def test_error
# keep test output clean: suppress timeout warning
orig = $VERBOSE; $VERBOSE = nil
assert_equal [], Geocoder.search("error")
ensure
$VERBOSE = orig
silence_warnings do
assert_equal [], Geocoder.search("error")
end
end
def test_result_components
......
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