diff --git a/spec/mongoid/geospatial/fields/polygon_spec.rb b/spec/mongoid/geospatial/fields/polygon_spec.rb index b524877..c71ba54 100644 --- a/spec/mongoid/geospatial/fields/polygon_spec.rb +++ b/spec/mongoid/geospatial/fields/polygon_spec.rb @@ -38,6 +38,16 @@ expect(geom.radius_sphere(10)[1]).to be_within(0.001).of(0.001569) end + it 'should handle BSON::Documents containing GeoJSON data' do + coordinates = [[[1, 1], [1, 2], [1, 1]]] + + document = BSON::Document.new(type: 'Polygon', coordinates: coordinates) + + geom = Mongoid::Geospatial::Polygon.new(document) + + expect([*geom]).to eq(coordinates) + end + describe 'with rgeo' do # farm.area.should be_a RGeo::Geographic::SphericalPolygonImpl end