Sha256: 42fae6b0762357aa710f8456c96b27d58d193dc97365c506815e5acb9cf72e5a

Contents?: true

Size: 867 Bytes

Versions: 1

Compression:

Stored size: 867 Bytes

Contents

# encoding: utf-8
require 'test_helper'

class ErrorHandlingTest < Test::Unit::TestCase

  def setup
    Geocoder::Configuration.set_defaults
  end

  def test_does_not_choke_on_timeout
    # keep test output clean: suppress timeout warning
    orig = $VERBOSE; $VERBOSE = nil
    all_lookups.each do |l|
      Geocoder::Configuration.lookup = l
      assert_nothing_raised { Geocoder.search("timeout") }
    end
    $VERBOSE = orig
  end

  def test_always_raise_timeout_error
    Geocoder::Configuration.always_raise = [TimeoutError]
    assert_raise(TimeoutError) { Geocoder.search("timeout") }
    Geocoder::Configuration.always_raise = []
  end

  def test_always_raise_socket_error
    Geocoder::Configuration.always_raise = [SocketError]
    assert_raise(SocketError) { Geocoder.search("socket_error") }
    Geocoder::Configuration.always_raise = []
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
geocoder-1.0.2 test/error_handling_test.rb