Sha256: 31deba035af2cb3c744c786d0a7270090176f1d67abda683602e6aa4c037a0da

Contents?: true

Size: 802 Bytes

Versions: 3

Compression:

Stored size: 802 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.7.2 spec/mongoid_geospatial/helpers/spatial_spec.rb
mongoid_geospatial-2.7.1 spec/mongoid_geospatial/helpers/spatial_spec.rb
mongoid_geospatial-2.7.0 spec/mongoid_geospatial/helpers/spatial_spec.rb