Permalink
Browse files

updated Gemfile

  • Loading branch information...
1 parent 16190b7 commit 913d242ba0475d4596f6b8343dffb519cea3ba1d @kristianmandrup committed Jun 19, 2011
Showing with 55 additions and 2 deletions.
  1. +1 −1 Gemfile
  2. +54 −1 spec/geo_calc/core_ext/hash_ext_spec.rb
View
@@ -9,7 +9,7 @@ gem 'activesupport', '>= 3.0.1'
# Add dependencies to develop your gem here.
# Include everything needed to run rake, tests, features, etc.
group :development do
- gem "geo_point", ">= 0.2.1"
+ gem "geo_point", ">= 0.2.2"
gem "rspec", ">= 2.5.0"
gem "bundler", ">= 1"
gem "jeweler", ">= 1.5.2"
@@ -1,4 +1,5 @@
require 'spec_helper'
+require 'geo_point'
describe GeoPoint do
describe 'ruby core Class extensions' do
@@ -27,12 +28,64 @@
end
end
- describe '#to_lat_lng' do
+ 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
+
+ describe '#to_lng_lat' do
+ it 'should return Array with lat, lng' do
+ @hash = {:lng => 2, :lat => "3"}
+ @hash.to_lng_lat.should == [2, 3]
+ end
+ end
+
+ context 'GeoPoint.coord_mode == :lng_lat' do
+ describe '#to_coords' do
+ it 'should return Array with lng, lat' do
+ GeoPoint.coord_mode = :lng_lat
+ @hash = {:lng => 2, :lat => "3"}
+ @hash.to_coords.should == [2, 3]
+ end
+ end
+ end
+
+ context 'GeoPoint.coord_mode == :lat_lng' do
+ describe '#to_coords' do
+ it 'should return Array with lat, lng' do
+ GeoPoint.coord_mode = :lat_lng
+ @hash = {:lng => 2, :lat => "3"}
+ @hash.to_coords.should == [3, 2]
+ end
+ end
+ end
+
+ describe '#geo_point' do
+ context 'GeoPoint.coord_mode == :lat_lng' do
+ it 'should return Array with lng, lat' do
+ GeoPoint.coord_mode = :lat_lng
+ @hash = {:lng => 2, :lat => "3"}
+ p = @hash.geo_point
+ puts p.inspect
+
+ p.to_lng_lat.should == [2, 3]
+ end
+ end
+
+ context 'GeoPoint.coord_mode == :lng_lat' do
+ it 'should return Array with lng, lat' do
+ GeoPoint.coord_mode = :lng_lat
+ @hash = {:lng => 2, :lat => "3"}
+ p = @hash.geo_point
+ puts p.inspect
+
+ p.to_lng_lat.should == [2, 3]
+ end
+ end
+ end
+
end # Hash
end
end

0 comments on commit 913d242

Please sign in to comment.