Sha256: 4314ce80873ff741644a9795c7e4067ea8965cd523c83d87a42568f5f72498c2

Contents?: true

Size: 1.02 KB

Versions: 9

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'
require 'geohash'

# Quick note, I'm not actually testing if the Geohash is accurate or not.
# I'm assuming the C Lib I imported is doing that for me properly.
describe Geohash do
  describe '.encode' do
    it 'encodes' do
      encode = Geohash.encode(1,1,1)
      expect(encode).to be_a String
    end
  end

  describe '.decode' do
    it 'decodes' do
      decode = Geohash.decode('s')
      expect(decode).to be_a Geocoord
    end
  end

  describe '.neighbours' do
    it 'finds my neighbours' do
      neighbours = Geohash.neighbours('s')
      expect(neighbours.sample).to be_a String
      expect(neighbours.length).to be 8
    end
  end

  describe '.precision' do
    it 'calculates the dimensions for precision' do
      dimensions = Geohash.dimensions(1)
      expect(dimensions).to be_a Dimension
    end
  end

  describe '.neighbour' do
    it 'calculates the neighbour in a direction' do
      north_neighbour = Geohash.neighbour('s', 0)
      expect(north_neighbour).to be_a String
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
dynamodb_geo-0.2.1 spec/geohash_spec.rb
dynamodb_geo-0.2.0 spec/geohash_spec.rb
dynamodb_geo-0.1.8 spec/geohash_spec.rb
dynamodb_geo-0.1.6 spec/geohash_spec.rb
dynamodb_geo-0.1.5 spec/geohash_spec.rb
dynamodb_geo-0.1.4 spec/geohash_spec.rb
dynamodb_geo-0.1.2 spec/geohash_spec.rb
dynamodb_geo-0.1.1 spec/geohash_spec.rb
dynamodb_geo-0.1.0 spec/geohash_spec.rb