Sha256: 9c8fe3179d292bdff70e6d37a5bfbeee8e50edb32e5e9e1a48febe910ddd0a09
Contents?: true
Size: 1.72 KB
Versions: 3
Compression:
Stored size: 1.72 KB
Contents
require 'spec_helper' # - www.movable-type.co.uk/scripts/latlong.html describe GeoPoint do describe 'ruby core Class extensions' do describe NumericLatLngExt do describe 'Fixnum extension' do describe '#to_lat' do it 'should set origin at 0,0' do origin = [0, 0].geo_point origin.lat.should == 0 origin.lng.should == 0 end it 'should return latitude degree value for 360' do 360.to_lat.should == 0 end it 'should normalize degrees before converting to latitude, so 361 becomes 1' do 361.to_lat.should == 1 end end describe '#to_lng' do it 'should return latitude degree value for 360' do 90.to_lng.should == 90 end it 'should normalize degrees before converting to latitude, so 361 becomes 1' do 91.to_lng.should == 91 end end end describe 'Float extension' do describe '#to_lat' do it 'should return latitude degree value for 360' do (360.0).to_lat.should == 0 end it 'should normalize degrees before converting to latitude, so 361 becomes 1' do (361.1).to_lat.should be_within(0.01).of(1.1) end end describe '#to_lng' do it 'should return latitude degree value for 360' do (360.0).to_lng.should == 0 end it 'should normalize degrees before converting to latitude, so 361 becomes 1' do (361.1).to_lng.should be_within(0.01).of(1.1) end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
geo_calc-0.6.1 | spec/geo_calc/core_ext_spec.rb |
geo_calc-0.6.0.1 | spec/geo_calc/core_ext_spec.rb |
geo_calc-0.6.0 | spec/geo_calc/core_ext_spec.rb |