Sha256: 1c7e0a35168f653ca452eb17d737d289cd3e89e40986a5f1acd7af2ffe064323

Contents?: true

Size: 1.06 KB

Versions: 16

Compression:

Stored size: 1.06 KB

Contents

require_relative '../lib/gmaps_geocoding'
require_relative 'test_helper'

# Main test class
class GmapsGeocodingApiTest < Test::Unit::TestCase
  def test_api_json_set
    opts = { address: 'Tour Eiffel, Paris, IDF, France', output: 'json' }
    api = GmapsGeocoding::Api.new(opts)
    assert_not_nil api

    result_location = api.location
    assert_not_nil result_location
    assert_kind_of Hash, result_location
    assert_include result_location, 'results'

    result_latlng = api.finest_latlng(result_location['results'])
    assert_not_nil result_latlng
    assert_instance_of Array, result_latlng
  end

  def test_api_xml_set
    opts = { address: 'Tour Eiffel, Paris, IDF, France', output: 'xml' }
    api = GmapsGeocoding::Api.new(opts)
    assert_not_nil api

    result_location = api.location
    assert_not_nil result_location
    assert_kind_of Hash, result_location
    assert_include result_location, 'result'

    result_latlng = api.finest_latlng(result_location['result'])
    assert_not_nil result_latlng
    assert_instance_of Array, result_latlng
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
gmaps_geocoding-1.3.5 test/gmaps_geocoding_api_test.rb
gmaps_geocoding-1.3.4 test/gmaps_geocoding_api_test.rb
gmaps_geocoding-1.3.3 test/gmaps_geocoding_api_test.rb
gmaps_geocoding-1.3.2 test/gmaps_geocoding_api_test.rb
gmaps_geocoding-1.3.1 test/gmaps_geocoding_api_test.rb
gmaps_geocoding-1.3.0 test/gmaps_geocoding_api_test.rb
gmaps_geocoding-1.2.2 test/gmaps_geocoding_api_test.rb
gmaps_geocoding-1.2.1 test/gmaps_geocoding_api_test.rb
gmaps_geocoding-1.2.0 test/gmaps_geocoding_api_test.rb
gmaps_geocoding-1.1.4 test/gmaps_geocoding_api_test.rb
gmaps_geocoding-1.1.3 test/gmaps_geocoding_api_test.rb
gmaps_geocoding-1.1.2 test/gmaps_geocoding_api_test.rb
gmaps_geocoding-1.1.1 test/gmaps_geocoding_api_test.rb
gmaps_geocoding-1.1.0 test/gmaps_geocoding_api_test.rb
gmaps_geocoding-1.0.1 test/gmaps_geocoding_api_test.rb
gmaps_geocoding-1.0.0 test/gmaps_geocoding_api_test.rb