Sha256: d7508bdb8173d7d8b3114b7c8eefc81ca722758b599e56615619c1a21a213123
Contents?: true
Size: 834 Bytes
Versions: 3
Compression:
Stored size: 834 Bytes
Contents
require 'spec_helper' describe GeoDistance::Spherical do let(:from) do [45, 10].geo_point end let(:to) do b = [42, 11].geo_point end describe '#distance' do it "should calculate spherical distance as Float" do dist = GeoDistance::Spherical.distance(from, to) dist.should be_a(Float) puts "the distance from #{from} to #{to} is: #{dist.kms_to(:meters)} meters" dist.should be_within(20).of 340 end end describe '#geo_distance' do it "should calculate spherical distance as GeoDistance" do dist = GeoDistance::Spherical.geo_distance(from, to) dist.should be_a(GeoDistance) puts "the distance from #{from} to #{to} is: #{dist.meters} meters" dist.kms.should be_within(20).of 340 end end end
Version data entries
3 entries across 3 versions & 1 rubygems