Sha256: f5c9473c1995db78be7f2d86077e0c1db0d77993c64e6c55bb9dd8753bb87f0d

Contents?: true

Size: 1.45 KB

Versions: 16

Compression:

Stored size: 1.45 KB

Contents

require 'helper'

class TestGeocoderClient < Test::Unit::TestCase
  should "test coordinats geocode" do
    geocoder_client = GeocoderClient.new
    geocoder_request = GeocoderRequest.new
    geocoder_request.latitude = '37.77493'
    geocoder_request.longitude = '-122.41942'
    request = geocoder_request
    response = geocoder_client.geocode(request)
    assert_equal Array, response.class
    assert_equal GeocoderResponse, response.first.class
    assert_equal "CAZ", response.first.code
  end

  should "test city geocode" do
    geocoder_client = GeocoderClient.new
    geocoder_request = GeocoderRequest.new
    geocoder_request.city = 'los angeles'
    request = geocoder_request
    response = geocoder_client.geocode(request)
    assert_equal Array, response.class
    assert_equal GeocoderResponse, response.first.class
    assert_equal "LAX",  response.first.code
  end

  should "test both city and geocode" do
    geocoder_client = GeocoderClient.new
    geocoder_request1 = GeocoderRequest.new
    geocoder_request1.latitude = '37.77493'
    geocoder_request1.longitude = '-122.41942'

    geocoder_request2 = GeocoderRequest.new
    geocoder_request2.city = 'los angeles'

    request = [geocoder_request1, geocoder_request2]
    response = geocoder_client.geocode(request)
    assert_equal Array, response.class
    assert_equal GeocoderResponse, response.first.class
    assert_equal "CAZ", response.first.code
    assert_equal "LAX", response[1].code
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
threetaps-client-1.0.14 test/client/test_geocoder_client.rb
threetaps-client-1.0.13 test/client/test_geocoder_client.rb
threetaps-client-1.0.12 test/client/test_geocoder_client.rb
threetaps-client-1.0.11 test/client/test_geocoder_client.rb
threetaps-client-1.0.10 test/client/test_geocoder_client.rb
threetaps-client-1.0.9 test/client/test_geocoder_client.rb
threetaps-client-1.0.8 test/client/test_geocoder_client.rb
threetaps-client-1.0.7 test/client/test_geocoder_client.rb
threetaps-client-1.0.6 test/client/test_geocoder_client.rb
threetaps-client-1.0.5 test/client/test_geocoder_client.rb
threetaps-client-1.0.4 test/client/test_geocoder_client.rb
threetaps-client-1.0.3 test/client/test_geocoder_client.rb
threetaps-client-1.0.2 test/client/test_geocoder_client.rb
threetaps-client-1.0.1 test/client/test_geocoder_client.rb
threetaps-client-1.0.0 test/client/test_geocoder_client.rb
threetaps-client-0.5.1 test/client/test_geocoder_client.rb