Sha256: 552fc2b7324ca189130fd39b8c088887ed5f91a09209432a2454981499b20831

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

describe GeoPoint do 
  describe 'ruby core Class extensions' do
    describe 'Hash extension' do
      describe '#to_lat' do              
        it 'should return latitude as #to_lat on the value for key :lat' do
          @hash = {:lat => 4}
          @hash.to_lat.should == 4
        end

        it 'should return latitude as #to_lat on the value for key :latitude' do
          @hash = {:latitude => "7"}
          @hash.to_lat.should == 7
        end
      end      

      describe '#to_lng' do              
        it 'should return latitude as #to_lng on the value for key :lng' do
          @hash = {:lng => 2}
          @hash.to_lng.should == 2
        end

        it 'should return latitude as #to_lng on the value for key :longitude' do
          @hash = {:longitude => "3.1"}
          @hash.to_lng.should == 3.1
        end 
      end

      describe '#to_lat_lng' do              
        it 'should return Array with lat, lng' do
          @hash = {:lng => 2, :lat => "3"}
          @hash.to_lat_lng.should == [3, 2]
        end
      end  
    end # Hash 
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
geo_calc-0.7.4 spec/geo_calc/core_ext/hash_ext_spec.rb
geo_calc-0.7.3 spec/geo_calc/core_ext/hash_ext_spec.rb