Sha256: 99592d95ba9c07c8605c14bceb5bd9fc10b87ef3b92ff90bd365d05a26fea763
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 KB
Contents
require "spec_helper" describe Mongoid::Geospatial::Point do it "should not inferfer with mongoid" do Bar.create!(name: "Moe's") Bar.count.should eql(1) end describe "queryable" do before do Bar.create_indexes Mongoid::Geospatial.use_rgeo end describe "(de)mongoize" do it "should mongoize array" do geom = Bar.new(location: [10, -9]).location geom.class.should eql(Mongoid::Geospatial::Point) geom.to_geo.class.should eql(RGeo::Geographic::SphericalPointImpl) geom.x.should be_within(0.1).of(10) geom.to_geo.y.should be_within(0.1).of(-9) end it "should mongoize hash" do geom = Bar.new(location: {x: 10, y: -9}).location geom.class.should eql(Mongoid::Geospatial::Point) geom.to_geo.class.should eql(RGeo::Geographic::SphericalPointImpl) end it "should accept an RGeo object" do pending point = RGeo::Geographic.spherical_factory.point 1, 2 bar = Bar.create!(location: point) bar.location.x.should be_within(0.1).of(1) bar.location.y.should be_within(0.1).of(2) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mongoid_geospatial-2.2.0 | spec/mongoid_geospatial/wrappers/rgeo_spec.rb |