spec/mongoid/geospatial/helpers/sphere_spec.rb in mongoid-geospatial-4.0.1 vs spec/mongoid/geospatial/helpers/sphere_spec.rb in mongoid-geospatial-5.0.0
- old
+ new
@@ -5,10 +5,19 @@
before do
Alarm.create_indexes
end
it 'should created indexes' do
- expect(Alarm.collection.indexes[spot: '2dsphere']).not_to be_nil
+ expect(Alarm.collection.indexes.get(spot: '2dsphere')).not_to be_nil
+ end
+
+ it 'should create correct indexes' do
+ expect(Alarm.collection.indexes.get(spot: '2dsphere'))
+ .to eq('2dsphereIndexVersion' => 2,
+ 'key' => { 'spot' => '2dsphere' },
+ 'name' => 'spot_2dsphere',
+ 'ns' => 'mongoid_geo_test.alarms',
+ 'v' => 1)
end
it 'should set spatial fields' do
expect(Alarm.spatial_fields).to eql([:spot])
end