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.
Files changed (97) hide show
  1. data/Gemfile +5 -4
  2. data/Guardfile +24 -0
  3. data/README.md +9 -3
  4. data/lib/mongoid_geospatial/{contexts → contextual}/mongo.rb +11 -6
  5. data/lib/mongoid_geospatial/criterion/complex.rb +7 -0
  6. data/lib/mongoid_geospatial/criterion/inclusion.rb +12 -12
  7. data/lib/mongoid_geospatial/extensions/rgeo_spherical_point_impl.rb +13 -0
  8. data/lib/mongoid_geospatial/fields/line_string.rb +7 -6
  9. data/lib/mongoid_geospatial/fields/point.rb +24 -11
  10. data/lib/mongoid_geospatial/fields/polygon.rb +14 -10
  11. data/lib/mongoid_geospatial/geospatial/geo_near_results.rb +1 -1
  12. data/lib/mongoid_geospatial/geospatial.rb +1 -29
  13. data/lib/mongoid_geospatial/version.rb +1 -1
  14. data/lib/mongoid_geospatial.rb +9 -5
  15. data/mongoid_geospatial.gemspec +4 -5
  16. data/spec/models/address.rb +19 -14
  17. data/spec/models/bar.rb +3 -1
  18. data/spec/models/event.rb +2 -2
  19. data/spec/models/farm.rb +3 -4
  20. data/spec/models/person.rb +18 -60
  21. data/spec/models/phone.rb +3 -1
  22. data/spec/models/river.rb +2 -2
  23. data/spec/{functional/contexts → mongoid_geospatial/contextual}/mongo_spec.rb +16 -8
  24. data/spec/mongoid_geospatial/criterion/inclusion_spec.rb +375 -0
  25. data/spec/mongoid_geospatial/fields/point_spec.rb +34 -0
  26. data/spec/mongoid_geospatial/fields/polygon_spec.rb +6 -0
  27. data/spec/{functional → mongoid_geospatial}/geospatial/geo_near_results_spec.rb +0 -0
  28. data/spec/mongoid_geospatial/geospatial_spec.rb +2 -0
  29. data/spec/mongoid_geospatial/mongoid_geospatial_spec.rb +83 -0
  30. data/spec/spec_helper.rb +36 -20
  31. data/spec/support/authentication.rb +23 -23
  32. metadata +23 -161
  33. data/spec/functional/criterion/inclusion_spec.rb +0 -360
  34. data/spec/functional/mongoid_geospatial_spec.rb +0 -54
  35. data/spec/models/account.rb +0 -19
  36. data/spec/models/acolyte.rb +0 -9
  37. data/spec/models/address_component.rb +0 -5
  38. data/spec/models/agent.rb +0 -10
  39. data/spec/models/alert.rb +0 -5
  40. data/spec/models/animal.rb +0 -21
  41. data/spec/models/answer.rb +0 -4
  42. data/spec/models/birthday.rb +0 -13
  43. data/spec/models/book.rb +0 -5
  44. data/spec/models/business.rb +0 -7
  45. data/spec/models/callbacks.rb +0 -57
  46. data/spec/models/category.rb +0 -13
  47. data/spec/models/circus.rb +0 -7
  48. data/spec/models/comment.rb +0 -13
  49. data/spec/models/country_code.rb +0 -6
  50. data/spec/models/description.rb +0 -11
  51. data/spec/models/division.rb +0 -5
  52. data/spec/models/drug.rb +0 -5
  53. data/spec/models/employer.rb +0 -5
  54. data/spec/models/entry.rb +0 -6
  55. data/spec/models/favorite.rb +0 -6
  56. data/spec/models/fruits.rb +0 -11
  57. data/spec/models/game.rb +0 -18
  58. data/spec/models/ghost.rb +0 -7
  59. data/spec/models/house.rb +0 -4
  60. data/spec/models/inheritance.rb +0 -90
  61. data/spec/models/league.rb +0 -5
  62. data/spec/models/location.rb +0 -5
  63. data/spec/models/login.rb +0 -6
  64. data/spec/models/membership.rb +0 -4
  65. data/spec/models/mixed_drink.rb +0 -4
  66. data/spec/models/name.rb +0 -13
  67. data/spec/models/namespacing.rb +0 -11
  68. data/spec/models/observed.rb +0 -41
  69. data/spec/models/override.rb +0 -16
  70. data/spec/models/owner.rb +0 -6
  71. data/spec/models/page.rb +0 -5
  72. data/spec/models/page_question.rb +0 -4
  73. data/spec/models/paranoid_post.rb +0 -18
  74. data/spec/models/parents.rb +0 -32
  75. data/spec/models/patient.rb +0 -15
  76. data/spec/models/pet.rb +0 -7
  77. data/spec/models/pet_owner.rb +0 -6
  78. data/spec/models/player.rb +0 -23
  79. data/spec/models/post.rb +0 -26
  80. data/spec/models/preference.rb +0 -9
  81. data/spec/models/question.rb +0 -8
  82. data/spec/models/quiz.rb +0 -6
  83. data/spec/models/rating.rb +0 -8
  84. data/spec/models/role.rb +0 -5
  85. data/spec/models/service.rb +0 -6
  86. data/spec/models/shelf.rb +0 -5
  87. data/spec/models/slave_address_numbers.rb +0 -14
  88. data/spec/models/survey.rb +0 -5
  89. data/spec/models/tag.rb +0 -6
  90. data/spec/models/tracking_id_validation_history.rb +0 -25
  91. data/spec/models/translation.rb +0 -5
  92. data/spec/models/tree.rb +0 -9
  93. data/spec/models/user.rb +0 -9
  94. data/spec/models/user_account.rb +0 -10
  95. data/spec/models/vet_visit.rb +0 -5
  96. data/spec/models/video.rb +0 -9
  97. data/spec/models/wiki_page.rb +0 -6
@@ -1,6 +0,0 @@
1
- class PetOwner
2
- include Mongoid::Document
3
- field :title
4
- embeds_one :pet
5
- embeds_one :address, :as => :addressable
6
- end
@@ -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
@@ -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
@@ -1,8 +0,0 @@
1
- class Question
2
- include Mongoid::Document
3
- field :content
4
- embedded_in :survey
5
- embeds_many :answers
6
-
7
- accepts_nested_attributes_for :answers, :reject_if => lambda { |a| a[:content].blank? }, :allow_destroy => true
8
- end
data/spec/models/quiz.rb DELETED
@@ -1,6 +0,0 @@
1
- class Quiz
2
- include Mongoid::Document
3
- include Mongoid::Timestamps::Created
4
- field :topic
5
- embeds_many :pages
6
- end
@@ -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
@@ -1,5 +0,0 @@
1
- class Role
2
- include Mongoid::Document
3
- field :name, :type => String
4
- recursively_embeds_many
5
- end
@@ -1,6 +0,0 @@
1
- class Service
2
- include Mongoid::Document
3
- field :sid
4
- embedded_in :person
5
- validates_numericality_of :sid
6
- end
data/spec/models/shelf.rb DELETED
@@ -1,5 +0,0 @@
1
- class Shelf
2
- include Mongoid::Document
3
- field :level, :type => Integer
4
- recursively_embeds_one
5
- end
@@ -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
@@ -1,5 +0,0 @@
1
- class Survey
2
- include Mongoid::Document
3
- embeds_many :questions
4
- accepts_nested_attributes_for :questions, :reject_if => lambda{ |a| a[:content].blank? }, :allow_destroy => true
5
- end
data/spec/models/tag.rb DELETED
@@ -1,6 +0,0 @@
1
- class Tag
2
- include Mongoid::Document
3
- field :text, :type => String
4
- references_and_referenced_in_many :posts
5
- references_and_referenced_in_many :related, :class_name => "Tag"
6
- end
@@ -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
@@ -1,5 +0,0 @@
1
- class Translation
2
- include Mongoid::Document
3
- field :language
4
- embedded_in :name
5
- end
data/spec/models/tree.rb DELETED
@@ -1,9 +0,0 @@
1
- class Tree
2
- include Mongoid::Document
3
-
4
- field :name
5
- field :evergreen, :type => Boolean
6
-
7
- scope :verdant, where(:evergreen => true)
8
- default_scope asc(:name)
9
- end
data/spec/models/user.rb DELETED
@@ -1,9 +0,0 @@
1
- class User
2
- include Mongoid::Document
3
-
4
- field :name
5
-
6
- references_one :account, :foreign_key => :creator_id
7
- references_many :posts, :foreign_key => :author_id
8
- references_many :descriptions
9
- end
@@ -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
@@ -1,5 +0,0 @@
1
- class VetVisit
2
- include Mongoid::Document
3
- field :date, :type => Date
4
- embedded_in :pet
5
- end
data/spec/models/video.rb DELETED
@@ -1,9 +0,0 @@
1
- class Video
2
- include Mongoid::Document
3
- field :title
4
- embedded_in :person
5
- referenced_in :post
6
- referenced_in :game
7
-
8
- default_scope asc(:title)
9
- end
@@ -1,6 +0,0 @@
1
- class WikiPage
2
- include Mongoid::Document
3
- include Mongoid::Versioning
4
- field :title, :type => String
5
- max_versions 5
6
- end