Sha256: a363814bf93f3f10a44a825872499e9fb0500e863bd1d1255e9967c07e6e3b44

Contents?: true

Size: 1.27 KB

Versions: 7

Compression:

Stored size: 1.27 KB

Contents

# encoding: utf-8
require 'test_helper'

class ResultTest < Test::Unit::TestCase

  def test_result_has_required_attributes
    all_lookups.each do |l|
      Geocoder::Configuration.lookup = l
      result = Geocoder.search([45.423733, -75.676333]).first
      assert_result_has_required_attributes(result)
    end
  end


  private # ------------------------------------------------------------------

  def assert_result_has_required_attributes(result)
    m = "Lookup #{Geocoder::Configuration.lookup} does not support %s attribute."
    assert result.coordinates.is_a?(Array),    m % "coordinates"
    assert result.latitude.is_a?(Float),       m % "latitude"
    assert result.longitude.is_a?(Float),      m % "longitude"
    assert result.city.is_a?(String),          m % "city"
    assert result.state.is_a?(String),         m % "state"
    assert result.state_code.is_a?(String),    m % "state_code"
    assert result.province.is_a?(String),      m % "province"
    assert result.province_code.is_a?(String), m % "province_code"
    assert result.postal_code.is_a?(String),   m % "postal_code"
    assert result.country.is_a?(String),       m % "country"
    assert result.country_code.is_a?(String),  m % "country_code"
    assert_not_nil result.address,             m % "address"
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
geocoder-1.1.2 test/result_test.rb
geocoder-1.1.1 test/result_test.rb
geocoder-1.1.0 test/result_test.rb
geocoder-1.0.5 test/result_test.rb
geocoder-1.0.4 test/result_test.rb
geocoder-1.0.3 test/result_test.rb
geocoder-1.0.2 test/result_test.rb