Sha256: 3a6cfbe88c2f548d13b7ffd4c278c2bb6de9c6206c534259cc9e326b71956229

Contents?: true

Size: 515 Bytes

Versions: 2

Compression:

Stored size: 515 Bytes

Contents

require 'spec_helper'

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

    it 'should created indexes' do
      expect(Alarm.collection.indexes[spot: '2dsphere']).not_to be_nil
    end

    it 'should set spatial fields' do
      expect(Alarm.spatial_fields).to eql([:spot])
    end

    it 'should work fine indexed' do
      far  = Alarm.create!(name: 'Far', spot: [7, 7])
      expect(far.spot).to be_instance_of(Mongoid::Geospatial::Point)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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