Sha256: ea753b062f0d5dfba6121e3adc737c7f4e7d92c20c490362820cab362fe8fc5c

Contents?: true

Size: 1.14 KB

Versions: 4

Compression:

Stored size: 1.14 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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
geo_calc-0.7.8 spec/geo_calc/core_ext/array_ext_spec.rb
geo_calc-0.7.7.1 spec/geo_calc/core_ext/array_ext_spec.rb
geo_calc-0.7.7 spec/geo_calc/core_ext/array_ext_spec.rb
geo_calc-0.7.6 spec/geo_calc/core_ext/array_ext_spec.rb