Sha256: 58b100d5916989eaa2aa0dcf34f06e5e1280a5dcea36b8302aa89e5e49b2135d
Contents?: true
Size: 1.07 KB
Versions: 1
Compression:
Stored size: 1.07 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::InvalidFormat => 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
enrichment_db-0.1.0 | test/geo/locator_test.rb |