Sha256: 38aac366e9a9bb729935f376fa5bd0bc17611296252bdd5f4173cb0f819783f3
Contents?: true
Size: 1.25 KB
Versions: 2
Compression:
Stored size: 1.25 KB
Contents
# encoding: utf-8 $: << File.join(File.dirname(__FILE__), "..") require 'test_helper' class ErrorHandlingTest < GeocoderTestCase def teardown Geocoder.configure(:always_raise => []) end def test_does_not_choke_on_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 end def test_always_raise_timeout_error Geocoder.configure(:always_raise => [TimeoutError]) Geocoder::Lookup.all_services_except_test.each do |l| next if l == :maxmind_local # local, does not raise timeout lookup = Geocoder::Lookup.get(l) set_api_key!(l) assert_raises TimeoutError do lookup.send(:results, Geocoder::Query.new("timeout")) end end end def test_always_raise_socket_error Geocoder.configure(:always_raise => [SocketError]) Geocoder::Lookup.all_services_except_test.each do |l| next if l == :maxmind_local # local, does not raise timeout lookup = Geocoder::Lookup.get(l) set_api_key!(l) assert_raises SocketError do lookup.send(:results, Geocoder::Query.new("socket_error")) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
geocoder-1.2.1 | test/unit/error_handling_test.rb |
geocoder-1.2.0 | test/unit/error_handling_test.rb |