Sha256: e34342179b0b61f8ef3a2a3e64e0070843544756dcbcb161505c964b7a0fd26a

Contents?: true

Size: 801 Bytes

Versions: 3

Compression:

Stored size: 801 Bytes

Contents

require "spec_helper"

describe Mongoid::Fields do

  context "spatial" do
    before do
      Bar.create_indexes
    end

    it "should created indexes" do
      Bar.index_options.keys.should include({:location => '2d'})
    end

    it "should set spatial fields" do
      Bar.spatial_fields.should eql([:location])
    end

    it "should set some class methods" do
      far  = Bar.create!(name: "Far", location: [7,7])
      near = Bar.create!(name: "Near", location: [2,2])
      Bar.nearby([1,1]).should eq([near, far])
    end

    # it "should set some class methods" do
    #   far  = Bar.create!(name: "Far", location: [7,7])
    #   near = Bar.create!(name: "Near", location: [2,2])
    #   Bar.near_location([1,1]).should eq([near, far])
    # end

  end

  context "geom" do
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mongoid_geospatial-2.8.2 spec/mongoid_geospatial/helpers/spatial_spec.rb
mongoid_geospatial-2.8.1 spec/mongoid_geospatial/helpers/spatial_spec.rb
mongoid_geospatial-2.8.0 spec/mongoid_geospatial/helpers/spatial_spec.rb