mongoid-versioning 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (189) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -8
  3. data/README.md +1 -1
  4. data/gemfiles/Mongoid_4.gemfile +4 -0
  5. data/gemfiles/Mongoid_5.gemfile +4 -0
  6. data/lib/mongoid/core_ext/fields/validators/macro.rb +1 -3
  7. data/lib/mongoid/core_ext/relations/options.rb +1 -3
  8. data/lib/mongoid/core_ext/versioning.rb +12 -3
  9. data/lib/mongoid/versioning/version.rb +1 -1
  10. data/mongoid-versioning.gemspec +3 -3
  11. data/spec/app/models/comment.rb +4 -4
  12. data/spec/mongoid/versioning_spec.rb +9 -5
  13. data/spec/spec_helper.rb +14 -2
  14. metadata +26 -187
  15. data/spec/app/models/account.rb +0 -28
  16. data/spec/app/models/acolyte.rb +0 -16
  17. data/spec/app/models/actor.rb +0 -19
  18. data/spec/app/models/actor_observer.rb +0 -15
  19. data/spec/app/models/actress.rb +0 -2
  20. data/spec/app/models/address_number.rb +0 -6
  21. data/spec/app/models/agency.rb +0 -5
  22. data/spec/app/models/agent.rb +0 -12
  23. data/spec/app/models/album.rb +0 -14
  24. data/spec/app/models/alert.rb +0 -5
  25. data/spec/app/models/animal.rb +0 -25
  26. data/spec/app/models/answer.rb +0 -4
  27. data/spec/app/models/appointment.rb +0 -7
  28. data/spec/app/models/article.rb +0 -10
  29. data/spec/app/models/artist.rb +0 -66
  30. data/spec/app/models/artwork.rb +0 -4
  31. data/spec/app/models/augmentation.rb +0 -11
  32. data/spec/app/models/band.rb +0 -25
  33. data/spec/app/models/bar.rb +0 -9
  34. data/spec/app/models/basic.rb +0 -6
  35. data/spec/app/models/bed.rb +0 -1
  36. data/spec/app/models/big_palette.rb +0 -2
  37. data/spec/app/models/birthday.rb +0 -13
  38. data/spec/app/models/book.rb +0 -12
  39. data/spec/app/models/breed.rb +0 -4
  40. data/spec/app/models/browser.rb +0 -6
  41. data/spec/app/models/building.rb +0 -5
  42. data/spec/app/models/building_address.rb +0 -5
  43. data/spec/app/models/bus.rb +0 -7
  44. data/spec/app/models/business.rb +0 -5
  45. data/spec/app/models/callback_recorder.rb +0 -25
  46. data/spec/app/models/callback_test.rb +0 -9
  47. data/spec/app/models/canvas.rb +0 -25
  48. data/spec/app/models/car.rb +0 -1
  49. data/spec/app/models/cat.rb +0 -8
  50. data/spec/app/models/category.rb +0 -8
  51. data/spec/app/models/child.rb +0 -4
  52. data/spec/app/models/child_doc.rb +0 -22
  53. data/spec/app/models/church.rb +0 -4
  54. data/spec/app/models/circle.rb +0 -3
  55. data/spec/app/models/circuit.rb +0 -4
  56. data/spec/app/models/circus.rb +0 -7
  57. data/spec/app/models/code.rb +0 -5
  58. data/spec/app/models/contractor.rb +0 -5
  59. data/spec/app/models/cookie.rb +0 -6
  60. data/spec/app/models/country_code.rb +0 -8
  61. data/spec/app/models/definition.rb +0 -7
  62. data/spec/app/models/description.rb +0 -11
  63. data/spec/app/models/dictionary.rb +0 -10
  64. data/spec/app/models/division.rb +0 -10
  65. data/spec/app/models/doctor.rb +0 -12
  66. data/spec/app/models/dog.rb +0 -6
  67. data/spec/app/models/dokument.rb +0 -5
  68. data/spec/app/models/driver.rb +0 -7
  69. data/spec/app/models/drug.rb +0 -6
  70. data/spec/app/models/email.rb +0 -6
  71. data/spec/app/models/employer.rb +0 -5
  72. data/spec/app/models/entry.rb +0 -6
  73. data/spec/app/models/eraser.rb +0 -1
  74. data/spec/app/models/event.rb +0 -22
  75. data/spec/app/models/exhibition.rb +0 -4
  76. data/spec/app/models/exhibitor.rb +0 -5
  77. data/spec/app/models/eye.rb +0 -9
  78. data/spec/app/models/eye_bowl.rb +0 -9
  79. data/spec/app/models/face.rb +0 -8
  80. data/spec/app/models/favorite.rb +0 -6
  81. data/spec/app/models/filesystem.rb +0 -4
  82. data/spec/app/models/firefox.rb +0 -4
  83. data/spec/app/models/fish.rb +0 -8
  84. data/spec/app/models/folder.rb +0 -7
  85. data/spec/app/models/folder_item.rb +0 -9
  86. data/spec/app/models/fruits.rb +0 -28
  87. data/spec/app/models/game.rb +0 -19
  88. data/spec/app/models/ghost.rb +0 -7
  89. data/spec/app/models/home.rb +0 -4
  90. data/spec/app/models/house.rb +0 -7
  91. data/spec/app/models/html_writer.rb +0 -3
  92. data/spec/app/models/image.rb +0 -22
  93. data/spec/app/models/implant.rb +0 -16
  94. data/spec/app/models/item.rb +0 -8
  95. data/spec/app/models/jar.rb +0 -7
  96. data/spec/app/models/label.rb +0 -40
  97. data/spec/app/models/language.rb +0 -5
  98. data/spec/app/models/lat_lng.rb +0 -15
  99. data/spec/app/models/league.rb +0 -11
  100. data/spec/app/models/learner.rb +0 -2
  101. data/spec/app/models/line_item.rb +0 -6
  102. data/spec/app/models/location.rb +0 -8
  103. data/spec/app/models/login.rb +0 -8
  104. data/spec/app/models/manufacturer.rb +0 -7
  105. data/spec/app/models/meat.rb +0 -4
  106. data/spec/app/models/membership.rb +0 -4
  107. data/spec/app/models/mixed_drink.rb +0 -4
  108. data/spec/app/models/movie.rb +0 -12
  109. data/spec/app/models/my_hash.rb +0 -2
  110. data/spec/app/models/name.rb +0 -21
  111. data/spec/app/models/node.rb +0 -5
  112. data/spec/app/models/note.rb +0 -12
  113. data/spec/app/models/ordered_post.rb +0 -6
  114. data/spec/app/models/ordered_preference.rb +0 -6
  115. data/spec/app/models/oscar.rb +0 -15
  116. data/spec/app/models/override.rb +0 -16
  117. data/spec/app/models/ownable.rb +0 -6
  118. data/spec/app/models/owner.rb +0 -6
  119. data/spec/app/models/page.rb +0 -5
  120. data/spec/app/models/page_question.rb +0 -4
  121. data/spec/app/models/palette.rb +0 -7
  122. data/spec/app/models/paranoid_phone.rb +0 -27
  123. data/spec/app/models/parent.rb +0 -5
  124. data/spec/app/models/parent_doc.rb +0 -6
  125. data/spec/app/models/passport.rb +0 -5
  126. data/spec/app/models/patient.rb +0 -9
  127. data/spec/app/models/pdf_writer.rb +0 -3
  128. data/spec/app/models/pencil.rb +0 -1
  129. data/spec/app/models/person.rb +0 -198
  130. data/spec/app/models/pet.rb +0 -23
  131. data/spec/app/models/pet_owner.rb +0 -6
  132. data/spec/app/models/phone.rb +0 -11
  133. data/spec/app/models/phone_observer.rb +0 -6
  134. data/spec/app/models/pizza.rb +0 -7
  135. data/spec/app/models/player.rb +0 -35
  136. data/spec/app/models/post.rb +0 -42
  137. data/spec/app/models/powerup.rb +0 -11
  138. data/spec/app/models/preference.rb +0 -9
  139. data/spec/app/models/princess.rb +0 -8
  140. data/spec/app/models/product.rb +0 -15
  141. data/spec/app/models/profile.rb +0 -5
  142. data/spec/app/models/pronunciation.rb +0 -5
  143. data/spec/app/models/purchase.rb +0 -4
  144. data/spec/app/models/question.rb +0 -8
  145. data/spec/app/models/quiz.rb +0 -7
  146. data/spec/app/models/rating.rb +0 -8
  147. data/spec/app/models/record.rb +0 -46
  148. data/spec/app/models/registry.rb +0 -4
  149. data/spec/app/models/role.rb +0 -5
  150. data/spec/app/models/root_category.rb +0 -4
  151. data/spec/app/models/sandwich.rb +0 -4
  152. data/spec/app/models/scheduler.rb +0 -7
  153. data/spec/app/models/seo.rb +0 -7
  154. data/spec/app/models/series.rb +0 -4
  155. data/spec/app/models/server.rb +0 -13
  156. data/spec/app/models/service.rb +0 -22
  157. data/spec/app/models/shape.rb +0 -12
  158. data/spec/app/models/shelf.rb +0 -5
  159. data/spec/app/models/shipping_container.rb +0 -5
  160. data/spec/app/models/shop.rb +0 -6
  161. data/spec/app/models/short_agent.rb +0 -4
  162. data/spec/app/models/short_quiz.rb +0 -5
  163. data/spec/app/models/slave.rb +0 -6
  164. data/spec/app/models/song.rb +0 -8
  165. data/spec/app/models/square.rb +0 -4
  166. data/spec/app/models/strategy.rb +0 -3
  167. data/spec/app/models/sub_item.rb +0 -3
  168. data/spec/app/models/survey.rb +0 -5
  169. data/spec/app/models/symptom.rb +0 -6
  170. data/spec/app/models/target.rb +0 -5
  171. data/spec/app/models/template.rb +0 -5
  172. data/spec/app/models/thing.rb +0 -9
  173. data/spec/app/models/tool.rb +0 -8
  174. data/spec/app/models/topping.rb +0 -5
  175. data/spec/app/models/track.rb +0 -38
  176. data/spec/app/models/translation.rb +0 -5
  177. data/spec/app/models/tree.rb +0 -9
  178. data/spec/app/models/truck.rb +0 -3
  179. data/spec/app/models/user.rb +0 -20
  180. data/spec/app/models/user_account.rb +0 -10
  181. data/spec/app/models/validation_callback.rb +0 -10
  182. data/spec/app/models/vehicle.rb +0 -11
  183. data/spec/app/models/version.rb +0 -5
  184. data/spec/app/models/vet_visit.rb +0 -5
  185. data/spec/app/models/video.rb +0 -13
  186. data/spec/app/models/weapon.rb +0 -11
  187. data/spec/app/models/word.rb +0 -12
  188. data/spec/app/models/word_origin.rb +0 -11
  189. data/spec/app/models/writer.rb +0 -11
@@ -1,5 +0,0 @@
1
- class Template
2
- include Mongoid::Document
3
- field :active, type: Boolean, default: false
4
- validates :active, presence: true
5
- end
@@ -1,9 +0,0 @@
1
- class Thing
2
- include Mongoid::Document
3
- before_destroy :dont_do_it
4
- embedded_in :actor
5
-
6
- def dont_do_it
7
- false
8
- end
9
- end
@@ -1,8 +0,0 @@
1
- class Tool
2
- include Mongoid::Document
3
- embedded_in :palette
4
- accepts_nested_attributes_for :palette
5
- end
6
-
7
- require "app/models/eraser"
8
- require "app/models/pencil"
@@ -1,5 +0,0 @@
1
- class Topping
2
- include Mongoid::Document
3
- field :name, type: String
4
- belongs_to :pizza
5
- end
@@ -1,38 +0,0 @@
1
- class Track
2
- include Mongoid::Document
3
- field :name, type: String
4
-
5
- field :before_create_called, type: Boolean, default: false
6
- field :before_save_called, type: Boolean, default: false
7
- field :before_update_called, type: Boolean, default: false
8
- field :before_validation_called, type: Boolean, default: false
9
- field :before_destroy_called, type: Boolean, default: false
10
-
11
- embedded_in :record
12
-
13
- before_create :before_create_stub
14
- before_save :before_save_stub
15
- before_update :before_update_stub
16
- before_validation :before_validation_stub
17
- before_destroy :before_destroy_stub
18
-
19
- def before_create_stub
20
- self.before_create_called = true
21
- end
22
-
23
- def before_save_stub
24
- self.before_save_called = true
25
- end
26
-
27
- def before_update_stub
28
- self.before_update_called = true
29
- end
30
-
31
- def before_validation_stub
32
- self.before_validation_called = true
33
- end
34
-
35
- def before_destroy_stub
36
- self.before_destroy_called = true
37
- end
38
- end
@@ -1,5 +0,0 @@
1
- class Translation
2
- include Mongoid::Document
3
- field :language
4
- embedded_in :name
5
- end
@@ -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
@@ -1,3 +0,0 @@
1
- class Truck < Vehicle
2
- embeds_one :bed
3
- end
@@ -1,20 +0,0 @@
1
- class User
2
- include Mongoid::Document
3
-
4
- field :name
5
- field :last_login, type: DateTime
6
- field :account_expires, type: Date
7
-
8
- has_one :account, foreign_key: :creator_id, validate: false
9
- has_many :posts, foreign_key: :author_id, validate: false
10
- has_many :descriptions
11
-
12
- has_and_belongs_to_many :followed_shops, inverse_of: :followers, class_name: "Shop"
13
- has_and_belongs_to_many :businesses, class_name: "Business", validate: false
14
- has_one :shop
15
-
16
- belongs_to :next, class_name: "User"
17
-
18
- accepts_nested_attributes_for :posts
19
- index name: 1
20
- end
@@ -1,10 +0,0 @@
1
- class UserAccount
2
- include Mongoid::Document
3
- field :username, type: String
4
- field :name, type: String
5
- field :email, type: String
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
- has_and_belongs_to_many :people
10
- end
@@ -1,10 +0,0 @@
1
- class ValidationCallback
2
- include Mongoid::Document
3
- field :history, type: Array, default: []
4
- validate do
5
- self.history << :validate
6
- end
7
-
8
- before_validation { self.history << :before_validation }
9
- after_validation { self.history << :after_validation }
10
- end
@@ -1,11 +0,0 @@
1
- class Vehicle
2
- include Mongoid::Document
3
- belongs_to :shipping_container
4
- belongs_to :driver
5
-
6
- accepts_nested_attributes_for :driver
7
- accepts_nested_attributes_for :shipping_container
8
- end
9
-
10
- require "app/models/car"
11
- require "app/models/truck"
@@ -1,5 +0,0 @@
1
- class Version
2
- include Mongoid::Document
3
- field :number, type: Integer
4
- embedded_in :memorable, polymorphic: true
5
- end
@@ -1,5 +0,0 @@
1
- class VetVisit
2
- include Mongoid::Document
3
- field :date, type: Date
4
- embedded_in :pet
5
- end
@@ -1,13 +0,0 @@
1
- class Video
2
- include Mongoid::Document
3
- field :title, type: String
4
- field :year, type: Integer
5
- field :release_dates, type: Set
6
- field :genres, type: Array
7
-
8
- embedded_in :person
9
- belongs_to :post
10
- belongs_to :game
11
-
12
- default_scope ->{ asc(:title) }
13
- end
@@ -1,11 +0,0 @@
1
- class Weapon
2
- include Mongoid::Document
3
-
4
- field :name
5
-
6
- belongs_to :player, inverse_of: :weapons
7
-
8
- after_build do
9
- self.name = "Holy Hand Grenade (#{player.frags})"
10
- end
11
- end
@@ -1,12 +0,0 @@
1
- class Word
2
- include Mongoid::Document
3
- field :name, type: String
4
-
5
- belongs_to :dictionary
6
-
7
- embeds_many :definitions, validate: false
8
- embeds_many :word_origins, validate: false
9
- embeds_one :pronunciation, validate: false
10
-
11
- accepts_nested_attributes_for :definitions, allow_destroy: true
12
- end
@@ -1,11 +0,0 @@
1
- class WordOrigin
2
- include Mongoid::Document
3
-
4
- field :_id, type: Integer, default: ->{ origin_id }
5
-
6
- field :origin_id, type: Integer
7
- field :country, type: String
8
- field :city, type: String
9
-
10
- embedded_in :word
11
- end
@@ -1,11 +0,0 @@
1
- class Writer
2
- include Mongoid::Document
3
- field :speed, type: Integer, default: 0
4
-
5
- embedded_in :canvas
6
-
7
- def write; end
8
- end
9
-
10
- require "app/models/pdf_writer"
11
- require "app/models/html_writer"