mongoid_geospatial 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +5 -4
- data/Guardfile +24 -0
- data/README.md +9 -3
- data/lib/mongoid_geospatial/{contexts → contextual}/mongo.rb +11 -6
- data/lib/mongoid_geospatial/criterion/complex.rb +7 -0
- data/lib/mongoid_geospatial/criterion/inclusion.rb +12 -12
- data/lib/mongoid_geospatial/extensions/rgeo_spherical_point_impl.rb +13 -0
- data/lib/mongoid_geospatial/fields/line_string.rb +7 -6
- data/lib/mongoid_geospatial/fields/point.rb +24 -11
- data/lib/mongoid_geospatial/fields/polygon.rb +14 -10
- data/lib/mongoid_geospatial/geospatial/geo_near_results.rb +1 -1
- data/lib/mongoid_geospatial/geospatial.rb +1 -29
- data/lib/mongoid_geospatial/version.rb +1 -1
- data/lib/mongoid_geospatial.rb +9 -5
- data/mongoid_geospatial.gemspec +4 -5
- data/spec/models/address.rb +19 -14
- data/spec/models/bar.rb +3 -1
- data/spec/models/event.rb +2 -2
- data/spec/models/farm.rb +3 -4
- data/spec/models/person.rb +18 -60
- data/spec/models/phone.rb +3 -1
- data/spec/models/river.rb +2 -2
- data/spec/{functional/contexts → mongoid_geospatial/contextual}/mongo_spec.rb +16 -8
- data/spec/mongoid_geospatial/criterion/inclusion_spec.rb +375 -0
- data/spec/mongoid_geospatial/fields/point_spec.rb +34 -0
- data/spec/mongoid_geospatial/fields/polygon_spec.rb +6 -0
- data/spec/{functional → mongoid_geospatial}/geospatial/geo_near_results_spec.rb +0 -0
- data/spec/mongoid_geospatial/geospatial_spec.rb +2 -0
- data/spec/mongoid_geospatial/mongoid_geospatial_spec.rb +83 -0
- data/spec/spec_helper.rb +36 -20
- data/spec/support/authentication.rb +23 -23
- metadata +23 -161
- data/spec/functional/criterion/inclusion_spec.rb +0 -360
- data/spec/functional/mongoid_geospatial_spec.rb +0 -54
- data/spec/models/account.rb +0 -19
- data/spec/models/acolyte.rb +0 -9
- data/spec/models/address_component.rb +0 -5
- data/spec/models/agent.rb +0 -10
- data/spec/models/alert.rb +0 -5
- data/spec/models/animal.rb +0 -21
- data/spec/models/answer.rb +0 -4
- data/spec/models/birthday.rb +0 -13
- data/spec/models/book.rb +0 -5
- data/spec/models/business.rb +0 -7
- data/spec/models/callbacks.rb +0 -57
- data/spec/models/category.rb +0 -13
- data/spec/models/circus.rb +0 -7
- data/spec/models/comment.rb +0 -13
- data/spec/models/country_code.rb +0 -6
- data/spec/models/description.rb +0 -11
- data/spec/models/division.rb +0 -5
- data/spec/models/drug.rb +0 -5
- data/spec/models/employer.rb +0 -5
- data/spec/models/entry.rb +0 -6
- data/spec/models/favorite.rb +0 -6
- data/spec/models/fruits.rb +0 -11
- data/spec/models/game.rb +0 -18
- data/spec/models/ghost.rb +0 -7
- data/spec/models/house.rb +0 -4
- data/spec/models/inheritance.rb +0 -90
- data/spec/models/league.rb +0 -5
- data/spec/models/location.rb +0 -5
- data/spec/models/login.rb +0 -6
- data/spec/models/membership.rb +0 -4
- data/spec/models/mixed_drink.rb +0 -4
- data/spec/models/name.rb +0 -13
- data/spec/models/namespacing.rb +0 -11
- data/spec/models/observed.rb +0 -41
- data/spec/models/override.rb +0 -16
- data/spec/models/owner.rb +0 -6
- data/spec/models/page.rb +0 -5
- data/spec/models/page_question.rb +0 -4
- data/spec/models/paranoid_post.rb +0 -18
- data/spec/models/parents.rb +0 -32
- data/spec/models/patient.rb +0 -15
- data/spec/models/pet.rb +0 -7
- data/spec/models/pet_owner.rb +0 -6
- data/spec/models/player.rb +0 -23
- data/spec/models/post.rb +0 -26
- data/spec/models/preference.rb +0 -9
- data/spec/models/question.rb +0 -8
- data/spec/models/quiz.rb +0 -6
- data/spec/models/rating.rb +0 -8
- data/spec/models/role.rb +0 -5
- data/spec/models/service.rb +0 -6
- data/spec/models/shelf.rb +0 -5
- data/spec/models/slave_address_numbers.rb +0 -14
- data/spec/models/survey.rb +0 -5
- data/spec/models/tag.rb +0 -6
- data/spec/models/tracking_id_validation_history.rb +0 -25
- data/spec/models/translation.rb +0 -5
- data/spec/models/tree.rb +0 -9
- data/spec/models/user.rb +0 -9
- data/spec/models/user_account.rb +0 -10
- data/spec/models/vet_visit.rb +0 -5
- data/spec/models/video.rb +0 -9
- data/spec/models/wiki_page.rb +0 -6
data/spec/models/pet_owner.rb
DELETED
data/spec/models/player.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
class Player
|
2
|
-
include Mongoid::Document
|
3
|
-
field :active, :type => Boolean
|
4
|
-
field :frags, :type => Integer
|
5
|
-
field :deaths, :type => Integer
|
6
|
-
field :status
|
7
|
-
|
8
|
-
named_scope :active, criteria.where(:active => true) do
|
9
|
-
def extension
|
10
|
-
"extension"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
named_scope :inactive, :where => { :active => false }
|
14
|
-
named_scope :frags_over, lambda { |count| { :where => { :frags.gt => count } } }
|
15
|
-
named_scope :deaths_under, lambda { |count| criteria.where(:deaths.lt => count) }
|
16
|
-
scope :deaths_over, lambda { |count| criteria.where(:deaths.gt => count) }
|
17
|
-
|
18
|
-
class << self
|
19
|
-
def alive
|
20
|
-
criteria.where(:status => "Alive")
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
data/spec/models/post.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
class Post
|
2
|
-
include Mongoid::Document
|
3
|
-
include Mongoid::MultiParameterAttributes
|
4
|
-
include Mongoid::Versioning
|
5
|
-
include Mongoid::Timestamps
|
6
|
-
|
7
|
-
field :title, :type => String
|
8
|
-
field :content, :type => String
|
9
|
-
field :rating, :type => Integer
|
10
|
-
|
11
|
-
belongs_to :person
|
12
|
-
belongs_to :author, :foreign_key => :author_id, :class_name => "User"
|
13
|
-
has_and_belongs_to_many :tags
|
14
|
-
has_many :videos, :validate => false
|
15
|
-
|
16
|
-
scope :recent, where(:created_at => { "$lt" => Time.now, "$gt" => 30.days.ago })
|
17
|
-
scope :posting, where(:content.in => [ "Posting" ])
|
18
|
-
|
19
|
-
validates_format_of :title, :without => /\$\$\$/
|
20
|
-
|
21
|
-
class << self
|
22
|
-
def old
|
23
|
-
where(:created_at => { "$lt" => 30.days.ago })
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
data/spec/models/preference.rb
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
class Preference
|
2
|
-
include Mongoid::Document
|
3
|
-
field :name, :type => String
|
4
|
-
field :value, :type => String
|
5
|
-
field :ranking, :type => Integer
|
6
|
-
has_and_belongs_to_many :people
|
7
|
-
validates_length_of :name, :minimum => 2, :allow_nil => true
|
8
|
-
scope :posting, where(:value.in => [ "Posting" ])
|
9
|
-
end
|
data/spec/models/question.rb
DELETED
data/spec/models/quiz.rb
DELETED
data/spec/models/rating.rb
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
class Rating
|
2
|
-
include Mongoid::Document
|
3
|
-
field :value, :type => Integer
|
4
|
-
referenced_in :ratable, :polymorphic => true
|
5
|
-
references_many :comments
|
6
|
-
validates_numericality_of :value, :less_than => 100, :allow_nil => true
|
7
|
-
validates :ratable, :associated => true
|
8
|
-
end
|
data/spec/models/role.rb
DELETED
data/spec/models/service.rb
DELETED
data/spec/models/shelf.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
# These models used for Github 263
|
2
|
-
class Slave
|
3
|
-
include Mongoid::Document
|
4
|
-
field :first_name
|
5
|
-
field :last_name
|
6
|
-
embeds_many :address_numbers
|
7
|
-
end
|
8
|
-
|
9
|
-
class AddressNumber
|
10
|
-
include Mongoid::Document
|
11
|
-
field :country_code, :type => Integer, :default => 1
|
12
|
-
field :number
|
13
|
-
embedded_in :slave
|
14
|
-
end
|
data/spec/models/survey.rb
DELETED
data/spec/models/tag.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# These models are spcific to test for Github #313.
|
2
|
-
module MyCompany
|
3
|
-
module Model
|
4
|
-
class TrackingId
|
5
|
-
include Mongoid::Document
|
6
|
-
include Mongoid::Timestamps
|
7
|
-
store_in :tracking_ids
|
8
|
-
embeds_many :validation_history, :class_name => "MyCompany::Model::TrackingIdValidationHistory"
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
module MyCompany
|
14
|
-
module Model
|
15
|
-
# A TrackingId validation state change
|
16
|
-
class TrackingIdValidationHistory
|
17
|
-
include Mongoid::Document
|
18
|
-
field :old_state, :type => String
|
19
|
-
field :new_state, :type => String
|
20
|
-
field :when_changed, :type => DateTime
|
21
|
-
attr_protected :_id
|
22
|
-
embedded_in :tracking_id, :class_name => "MyCompany::Model::TrackingId"
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
data/spec/models/translation.rb
DELETED
data/spec/models/tree.rb
DELETED
data/spec/models/user.rb
DELETED
data/spec/models/user_account.rb
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
class UserAccount
|
2
|
-
include Mongoid::Document
|
3
|
-
field :username
|
4
|
-
field :name
|
5
|
-
field :email
|
6
|
-
validates_uniqueness_of :username, :message => "is not unique"
|
7
|
-
validates_uniqueness_of :email, :message => "is not unique", :case_sensitive => false
|
8
|
-
validates_length_of :name, :minimum => 2, :allow_nil => true
|
9
|
-
references_and_referenced_in_many :people
|
10
|
-
end
|
data/spec/models/vet_visit.rb
DELETED
data/spec/models/video.rb
DELETED