Sha256: 3ada378d6c323f27199e98f64f5da689ed3d16269a73566197b43f1779913da4
Contents?: true
Size: 1.08 KB
Versions: 4
Compression:
Stored size: 1.08 KB
Contents
require "#{File.dirname(__FILE__)}/../test_helper" describe EnrichmentDb::Geo::Locator do it 'should find id from a hash of hashes' do id = 2 data = { 'c' => { 'id' => 1, 'b_id' => id }, 'b' => { 'id' => 3 } } region_type = 'b' result = EnrichmentDb::Geo::Locator.find_id(data, region_type) assert_equal id, result end it 'should correctly format a has to a latlong' do lat = 10 long = 180 lat_long = { 'lat' => lat, 'long' => long } geohash = EnrichmentDb::Geo::Locator.format_geo(lat_long) assert_equal 'xczbzurypzpg', geohash end it 'should break as the lat long format is incorrect' do lat = 10 long = 180 lat_long = { 'lat' => lat, 'lon' => long } begin EnrichmentDb::Geo::Locator.format_geo(lat_long) rescue EnrichmentDb::InvalidGeoPointFormat => e else flunk('This should have errored out.') end end it 'should ' do geo = 'r1r0g2e' result = EnrichmentDb::Geo::Locator.geo_locate(geo) puts result.smallest_region.inspect puts result.name.inspect puts result.inspect end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
enrichment_db-0.1.4 | test/geo/locator_test.rb |
enrichment_db-0.1.3 | test/geo/locator_test.rb |
enrichment_db-0.1.2 | test/geo/locator_test.rb |
enrichment_db-0.1.1 | test/geo/locator_test.rb |