Sha256: 5286611a5a4f7923a6e2f8b04ef3bea7bf896ae038521b8cadf9c498ab8bee2e

Contents?: true

Size: 1.3 KB

Versions: 4

Compression:

Stored size: 1.3 KB

Contents

require 'spec_helper'

# - www.movable-type.co.uk/scripts/latlong.html
describe GeoPoint do 
  describe 'ruby core Class extensions' do
    describe 'Array extension' do
      describe '#to_lat' do              
        it 'should return latitude as first element' do
          @arr = [4, 27]
          @arr.to_lat.should == 4
        end

        it 'should return latitude as #to_lng of first element' do
          @arr = ["4.1", 27]
          @arr.to_lat.should == 4.1
        end
      end      

      describe '#to_lng' do              
        it 'should return latitude degree value for 360' do
          @arr = [4, 27]            
          @arr.to_lng.should == 27
        end

        it 'should return latitude as #to_lng of first element' do
          @arr = [4, "27.2"]            
          @arr.to_lng.should == 27.2
        end
      end   

      describe '#to_lat_lng' do              
        it 'should return Array with lat, lng' do
          @arr = ["3", {:lng => "2"}]
          @arr.to_lat_lng.should == [3, 2]
        end
      end 
  
      describe '#geo_point' do              
        it 'should return a GeoPoint' do
          @p = [3, 2].geo_point
          @p.should be_a(GeoPoint)
          @p.to_lat_lng.should == [3, 2]
        end
      end                            
    end # Array
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
geo_calc-0.7.1 spec/geo_calc/core_ext/array_ext_spec.rb
geo_calc-0.6.1 spec/geo_calc/core_ext/array_ext_spec.rb
geo_calc-0.6.0.1 spec/geo_calc/core_ext/array_ext_spec.rb
geo_calc-0.6.0 spec/geo_calc/core_ext/array_ext_spec.rb