mongoid-geospatial 4.0.1 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,7 +7,15 @@ describe Mongoid::Fields do
7
7
  end
8
8
 
9
9
  it 'should created indexes' do
10
- expect(Bar.collection.indexes[location: '2d']).not_to be_nil
10
+ expect(Bar.collection.indexes.get(location: '2d')).not_to be_nil
11
+ end
12
+
13
+ it 'should create correct indexes' do
14
+ expect(Bar.collection.indexes.get(location: '2d'))
15
+ .to eq('key' => { 'location' => '2d' },
16
+ 'name' => 'location_2d',
17
+ 'ns' => 'mongoid_geo_test.bars',
18
+ 'v' => 1)
11
19
  end
12
20
 
13
21
  it 'should set spatial fields' do
@@ -7,7 +7,16 @@ describe Mongoid::Fields do
7
7
  end
8
8
 
9
9
  it 'should created indexes' do
10
- expect(Alarm.collection.indexes[spot: '2dsphere']).not_to be_nil
10
+ expect(Alarm.collection.indexes.get(spot: '2dsphere')).not_to be_nil
11
+ end
12
+
13
+ it 'should create correct indexes' do
14
+ expect(Alarm.collection.indexes.get(spot: '2dsphere'))
15
+ .to eq('2dsphereIndexVersion' => 2,
16
+ 'key' => { 'spot' => '2dsphere' },
17
+ 'name' => 'spot_2dsphere',
18
+ 'ns' => 'mongoid_geo_test.alarms',
19
+ 'v' => 1)
11
20
  end
12
21
 
13
22
  it 'should set spatial fields' do
@@ -93,7 +93,8 @@ describe 'RGeo Wrapper' do
93
93
  it 'should mongoize array' do
94
94
  geom = Farm.create!(area: [[5, 5], [6, 5], [6, 6], [5, 6]]).area
95
95
  expect(geom.class).to eql(Mongoid::Geospatial::Polygon)
96
- expect(geom.to_rgeo.class).to eql(RGeo::Geographic::SphericalPolygonImpl)
96
+ expect(geom.to_rgeo.class)
97
+ .to eql(RGeo::Geographic::SphericalPolygonImpl)
97
98
  expect(geom.to_rgeo.to_s)
98
99
  .to eq 'POLYGON ((5.0 5.0, 6.0 5.0, 6.0 6.0, 5.0 6.0, 5.0 5.0))'
99
100
  end
@@ -103,7 +104,8 @@ describe 'RGeo Wrapper' do
103
104
  it 'should mongoize array' do
104
105
  geom = River.create!(course: [[5, 5], [6, 5], [6, 6], [5, 6]]).course
105
106
  expect(geom.class).to eql(Mongoid::Geospatial::LineString)
106
- expect(geom.to_rgeo.class).to eql(RGeo::Geographic::SphericalLineStringImpl)
107
+ expect(geom.to_rgeo.class)
108
+ .to eql(RGeo::Geographic::SphericalLineStringImpl)
107
109
  expect(geom.to_rgeo.to_s)
108
110
  .to eq 'LINESTRING (5.0 5.0, 6.0 5.0, 6.0 6.0, 5.0 6.0)'
109
111
  end
@@ -17,16 +17,14 @@ if ENV['CI']
17
17
  # end
18
18
  end
19
19
 
20
+ require 'pry'
20
21
  require 'rspec'
21
-
22
22
  require 'mongoid'
23
23
  # require "mocha"
24
24
  require 'mongoid/geospatial'
25
25
 
26
26
  LOGGER = Logger.new($stdout)
27
27
 
28
- puts "Running with Mongoid v#{Mongoid::VERSION}"
29
-
30
28
  Mongoid.configure do |config|
31
29
  config.connect_to('mongoid_geo_test')
32
30
  end
@@ -46,3 +44,9 @@ RSpec.configure do |config|
46
44
  Mongoid.purge!
47
45
  end
48
46
  end
47
+
48
+ Mongo::Logger.logger.level = Logger::INFO if Mongoid::VERSION >= '5'
49
+
50
+ # Mongoid.load!(File.expand_path('../support/mongoid.yml', __FILE__), :test)
51
+
52
+ puts "Running with Mongoid v#{Mongoid::VERSION}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-geospatial
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.1
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Ong
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-04-04 00:00:00.000000000 Z
12
+ date: 2015-07-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mongoid
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: 4.0.0
20
+ version: 5.0.0.beta
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: 4.0.0
27
+ version: 5.0.0.beta
28
28
  description: Mongoid Extension that simplifies MongoDB casting and operations on spatial
29
29
  Ruby objects.
30
30
  email:
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  version: '0'
106
106
  requirements: []
107
107
  rubyforge_project:
108
- rubygems_version: 2.4.5
108
+ rubygems_version: 2.4.8
109
109
  signing_key:
110
110
  specification_version: 4
111
111
  summary: Mongoid Extension that simplifies MongoDB Geospatial Operations.