spec/mongoid/geospatial/geospatial_spec.rb in mongoid-geospatial-3.9.0 vs spec/mongoid/geospatial/geospatial_spec.rb in mongoid-geospatial-4.0.0
- old
+ new
@@ -1,39 +1,33 @@
require 'spec_helper'
describe Mongoid::Geospatial do
-
context 'Class Stuff' do
-
it 'should have an lng_symbols accessor' do
expect(Mongoid::Geospatial.lng_symbols).to be_instance_of Array
expect(Mongoid::Geospatial.lng_symbols).to include :x
end
it 'should have an lat_symbols accessor' do
expect(Mongoid::Geospatial.lat_symbols).to be_instance_of Array
expect(Mongoid::Geospatial.lat_symbols).to include :y
end
-
end
context 'Creating indexes' do
-
it 'should create a 2d index' do
Bar.create_indexes
expect(Bar.collection.indexes[location: '2d']).not_to be_nil
end
it 'should create a 2dsphere index' do
Alarm.create_indexes
expect(Alarm.collection.indexes[spot: '2dsphere']).not_to be_nil
end
-
end
context '#nearby 2d' do
-
before do
Bar.create_indexes
end
let!(:jfk) do
@@ -42,18 +36,16 @@
let!(:lax) do
Bar.create(name: 'lax', location: [-118.40, 33.94])
end
- it 'should work with specifying specific center and different location attribute on collction' do
+ it 'should work specifing center and different location' do
expect(Bar.nearby(lax.location)).to eq([lax, jfk])
end
-
end
context '#nearby 2dsphere' do
-
before do
Alarm.create_indexes
end
let!(:jfk) do
@@ -137,7 +129,6 @@
# it "per_page=5" do
# Bar.geo_near([1,1], :page => 1, :per_page => 5).size.should == 5
# end
end
-
end