Sha256: 2f2024512c31b640edb310f1fb2ce89f7f0a77d7ac80be3aa60e35ada893f8e1
Contents?: true
Size: 1.76 KB
Versions: 1
Compression:
Stored size: 1.76 KB
Contents
require 'spec_helper' # - www.movable-type.co.uk/scripts/latlong.html describe GeoCalc do describe 'ruby core Class extensions' do describe 'Array extension' do describe '#to_lat' do it 'should return latitude as first element' do [4, 27].to_lat.should == 4 end it 'should return latitude as #to_lng of first element' do ["4.1", 27].to_lat.should == 4.1 end end describe '#to_lng' do it 'should return latitude degree value for 360' do [4, 27].to_lng.should == 27 end it 'should return latitude as #to_lng of first element' do [4, "27.2"].to_lng.should == 27.2 end end describe '#to_lat_lng' do it 'should return Array with lat, lng' do ["3", {:lng => "2"}].to_lat_lng.should == [3, 2] end end describe '#to_lng_lat' do it 'should return Array with lat, lng' do ["3", {:lng => "2"}].to_lng_lat.should == [2, 3] end end end # Array end end class GeoPoint mattr_accessor :coord_mode end describe 'coord mode' do context 'coord_mode = :lng_lat' do before do GeoPoint.coord_mode = :lng_lat end it 'should not reverse array' do [2, 3].to_lng_lat.should == [2, 3] end it 'should reverse array' do [2, 3].to_lat_lng.should == [3, 2] end end context 'coord_mode = :lat_lng' do before do GeoPoint.coord_mode = :lat_lng end it 'should not reverse array' do [2, 3].to_lat_lng.should == [2, 3] end it 'should reverse array' do [2, 3].to_lng_lat.should == [3, 2] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
geo_calc-0.7.5 | spec/geo_calc/core_ext/array_ext_spec.rb |