Sha256: 28c39810cdf96ec01fd195e386acf3107d307dc377f02946db7545432a2d95cf
Contents?: true
Size: 1.61 KB
Versions: 1
Compression:
Stored size: 1.61 KB
Contents
require 'spec_helper' # - www.movable-type.co.uk/scripts/latlong.html describe GeoPoint do describe 'ruby core Class extensions' 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
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
geo_calc-0.7.1 | spec/geo_calc/core_ext_spec.rb |