Sha256: e5476379eefb0ec415d257d8d18f7e1088132fd63efc4b6f3f193db51bcc5a60

Contents?: true

Size: 811 Bytes

Versions: 2

Compression:

Stored size: 811 Bytes

Contents

require 'spec_helper'

describe Mongoid::Fields do
  context 'spatial' do
    before do
      Bar.create_indexes
    end

    it 'should created indexes' do
      expect(Bar.collection.indexes[location: '2d']).not_to be_nil
    end

    it 'should set spatial fields' do
      expect(Bar.spatial_fields).to 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])
      expect(Bar.nearby([1, 1])).to 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

2 entries across 2 versions & 1 rubygems

Version Path
mongoid-geospatial-4.0.1 spec/mongoid/geospatial/helpers/spatial_spec.rb
mongoid-geospatial-4.0.0 spec/mongoid/geospatial/helpers/spatial_spec.rb