Sha256: 048551fcc400ac0596fbfd8c80aa3ac894fa8a9027504b45bda52f04b15f02e1
Contents?: true
Size: 921 Bytes
Versions: 1
Compression:
Stored size: 921 Bytes
Contents
describe GeoRb::Distance do subject { described_class.new(*locations).km } let(:north_pole) { GeoRb::Point.new(90, 0) } let(:south_pole) { GeoRb::Point.new(-90, 0) } let(:earth_radius) { described_class::EARTH_RADIUS } let(:earth_circumference) { 2 * Math::PI * earth_radius } describe "#measure" do context "when points are the same" do let(:locations) { %w[0,0 0,0] } it { is_expected.to eq 0 } end context "when distinct points" do let(:locations) { %w[0,0 0,1] } it { is_expected.to_not eq 0 } end context "when across antimeridian" do let(:nines) { 1 - 1e-30 } # 0.(9) let(:locations) { [[0, -179 - nines], [0, 179 + nines]] } it { is_expected.to eq 0 } end context "when trip between poles" do let(:locations) { [north_pole, south_pole] } it { should be_within(12).of(earth_circumference / 2) } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
geo_rb-0.0.1 | spec/geo_rb/distance_spec.rb |