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.
- checksums.yaml +4 -4
- data/.travis.yml +3 -8
- data/README.md +1 -1
- data/gemfiles/Mongoid_4.gemfile +4 -0
- data/gemfiles/Mongoid_5.gemfile +4 -0
- data/lib/mongoid/core_ext/fields/validators/macro.rb +1 -3
- data/lib/mongoid/core_ext/relations/options.rb +1 -3
- data/lib/mongoid/core_ext/versioning.rb +12 -3
- data/lib/mongoid/versioning/version.rb +1 -1
- data/mongoid-versioning.gemspec +3 -3
- data/spec/app/models/comment.rb +4 -4
- data/spec/mongoid/versioning_spec.rb +9 -5
- data/spec/spec_helper.rb +14 -2
- metadata +26 -187
- data/spec/app/models/account.rb +0 -28
- data/spec/app/models/acolyte.rb +0 -16
- data/spec/app/models/actor.rb +0 -19
- data/spec/app/models/actor_observer.rb +0 -15
- data/spec/app/models/actress.rb +0 -2
- data/spec/app/models/address_number.rb +0 -6
- data/spec/app/models/agency.rb +0 -5
- data/spec/app/models/agent.rb +0 -12
- data/spec/app/models/album.rb +0 -14
- data/spec/app/models/alert.rb +0 -5
- data/spec/app/models/animal.rb +0 -25
- data/spec/app/models/answer.rb +0 -4
- data/spec/app/models/appointment.rb +0 -7
- data/spec/app/models/article.rb +0 -10
- data/spec/app/models/artist.rb +0 -66
- data/spec/app/models/artwork.rb +0 -4
- data/spec/app/models/augmentation.rb +0 -11
- data/spec/app/models/band.rb +0 -25
- data/spec/app/models/bar.rb +0 -9
- data/spec/app/models/basic.rb +0 -6
- data/spec/app/models/bed.rb +0 -1
- data/spec/app/models/big_palette.rb +0 -2
- data/spec/app/models/birthday.rb +0 -13
- data/spec/app/models/book.rb +0 -12
- data/spec/app/models/breed.rb +0 -4
- data/spec/app/models/browser.rb +0 -6
- data/spec/app/models/building.rb +0 -5
- data/spec/app/models/building_address.rb +0 -5
- data/spec/app/models/bus.rb +0 -7
- data/spec/app/models/business.rb +0 -5
- data/spec/app/models/callback_recorder.rb +0 -25
- data/spec/app/models/callback_test.rb +0 -9
- data/spec/app/models/canvas.rb +0 -25
- data/spec/app/models/car.rb +0 -1
- data/spec/app/models/cat.rb +0 -8
- data/spec/app/models/category.rb +0 -8
- data/spec/app/models/child.rb +0 -4
- data/spec/app/models/child_doc.rb +0 -22
- data/spec/app/models/church.rb +0 -4
- data/spec/app/models/circle.rb +0 -3
- data/spec/app/models/circuit.rb +0 -4
- data/spec/app/models/circus.rb +0 -7
- data/spec/app/models/code.rb +0 -5
- data/spec/app/models/contractor.rb +0 -5
- data/spec/app/models/cookie.rb +0 -6
- data/spec/app/models/country_code.rb +0 -8
- data/spec/app/models/definition.rb +0 -7
- data/spec/app/models/description.rb +0 -11
- data/spec/app/models/dictionary.rb +0 -10
- data/spec/app/models/division.rb +0 -10
- data/spec/app/models/doctor.rb +0 -12
- data/spec/app/models/dog.rb +0 -6
- data/spec/app/models/dokument.rb +0 -5
- data/spec/app/models/driver.rb +0 -7
- data/spec/app/models/drug.rb +0 -6
- data/spec/app/models/email.rb +0 -6
- data/spec/app/models/employer.rb +0 -5
- data/spec/app/models/entry.rb +0 -6
- data/spec/app/models/eraser.rb +0 -1
- data/spec/app/models/event.rb +0 -22
- data/spec/app/models/exhibition.rb +0 -4
- data/spec/app/models/exhibitor.rb +0 -5
- data/spec/app/models/eye.rb +0 -9
- data/spec/app/models/eye_bowl.rb +0 -9
- data/spec/app/models/face.rb +0 -8
- data/spec/app/models/favorite.rb +0 -6
- data/spec/app/models/filesystem.rb +0 -4
- data/spec/app/models/firefox.rb +0 -4
- data/spec/app/models/fish.rb +0 -8
- data/spec/app/models/folder.rb +0 -7
- data/spec/app/models/folder_item.rb +0 -9
- data/spec/app/models/fruits.rb +0 -28
- data/spec/app/models/game.rb +0 -19
- data/spec/app/models/ghost.rb +0 -7
- data/spec/app/models/home.rb +0 -4
- data/spec/app/models/house.rb +0 -7
- data/spec/app/models/html_writer.rb +0 -3
- data/spec/app/models/image.rb +0 -22
- data/spec/app/models/implant.rb +0 -16
- data/spec/app/models/item.rb +0 -8
- data/spec/app/models/jar.rb +0 -7
- data/spec/app/models/label.rb +0 -40
- data/spec/app/models/language.rb +0 -5
- data/spec/app/models/lat_lng.rb +0 -15
- data/spec/app/models/league.rb +0 -11
- data/spec/app/models/learner.rb +0 -2
- data/spec/app/models/line_item.rb +0 -6
- data/spec/app/models/location.rb +0 -8
- data/spec/app/models/login.rb +0 -8
- data/spec/app/models/manufacturer.rb +0 -7
- data/spec/app/models/meat.rb +0 -4
- data/spec/app/models/membership.rb +0 -4
- data/spec/app/models/mixed_drink.rb +0 -4
- data/spec/app/models/movie.rb +0 -12
- data/spec/app/models/my_hash.rb +0 -2
- data/spec/app/models/name.rb +0 -21
- data/spec/app/models/node.rb +0 -5
- data/spec/app/models/note.rb +0 -12
- data/spec/app/models/ordered_post.rb +0 -6
- data/spec/app/models/ordered_preference.rb +0 -6
- data/spec/app/models/oscar.rb +0 -15
- data/spec/app/models/override.rb +0 -16
- data/spec/app/models/ownable.rb +0 -6
- data/spec/app/models/owner.rb +0 -6
- data/spec/app/models/page.rb +0 -5
- data/spec/app/models/page_question.rb +0 -4
- data/spec/app/models/palette.rb +0 -7
- data/spec/app/models/paranoid_phone.rb +0 -27
- data/spec/app/models/parent.rb +0 -5
- data/spec/app/models/parent_doc.rb +0 -6
- data/spec/app/models/passport.rb +0 -5
- data/spec/app/models/patient.rb +0 -9
- data/spec/app/models/pdf_writer.rb +0 -3
- data/spec/app/models/pencil.rb +0 -1
- data/spec/app/models/person.rb +0 -198
- data/spec/app/models/pet.rb +0 -23
- data/spec/app/models/pet_owner.rb +0 -6
- data/spec/app/models/phone.rb +0 -11
- data/spec/app/models/phone_observer.rb +0 -6
- data/spec/app/models/pizza.rb +0 -7
- data/spec/app/models/player.rb +0 -35
- data/spec/app/models/post.rb +0 -42
- data/spec/app/models/powerup.rb +0 -11
- data/spec/app/models/preference.rb +0 -9
- data/spec/app/models/princess.rb +0 -8
- data/spec/app/models/product.rb +0 -15
- data/spec/app/models/profile.rb +0 -5
- data/spec/app/models/pronunciation.rb +0 -5
- data/spec/app/models/purchase.rb +0 -4
- data/spec/app/models/question.rb +0 -8
- data/spec/app/models/quiz.rb +0 -7
- data/spec/app/models/rating.rb +0 -8
- data/spec/app/models/record.rb +0 -46
- data/spec/app/models/registry.rb +0 -4
- data/spec/app/models/role.rb +0 -5
- data/spec/app/models/root_category.rb +0 -4
- data/spec/app/models/sandwich.rb +0 -4
- data/spec/app/models/scheduler.rb +0 -7
- data/spec/app/models/seo.rb +0 -7
- data/spec/app/models/series.rb +0 -4
- data/spec/app/models/server.rb +0 -13
- data/spec/app/models/service.rb +0 -22
- data/spec/app/models/shape.rb +0 -12
- data/spec/app/models/shelf.rb +0 -5
- data/spec/app/models/shipping_container.rb +0 -5
- data/spec/app/models/shop.rb +0 -6
- data/spec/app/models/short_agent.rb +0 -4
- data/spec/app/models/short_quiz.rb +0 -5
- data/spec/app/models/slave.rb +0 -6
- data/spec/app/models/song.rb +0 -8
- data/spec/app/models/square.rb +0 -4
- data/spec/app/models/strategy.rb +0 -3
- data/spec/app/models/sub_item.rb +0 -3
- data/spec/app/models/survey.rb +0 -5
- data/spec/app/models/symptom.rb +0 -6
- data/spec/app/models/target.rb +0 -5
- data/spec/app/models/template.rb +0 -5
- data/spec/app/models/thing.rb +0 -9
- data/spec/app/models/tool.rb +0 -8
- data/spec/app/models/topping.rb +0 -5
- data/spec/app/models/track.rb +0 -38
- data/spec/app/models/translation.rb +0 -5
- data/spec/app/models/tree.rb +0 -9
- data/spec/app/models/truck.rb +0 -3
- data/spec/app/models/user.rb +0 -20
- data/spec/app/models/user_account.rb +0 -10
- data/spec/app/models/validation_callback.rb +0 -10
- data/spec/app/models/vehicle.rb +0 -11
- data/spec/app/models/version.rb +0 -5
- data/spec/app/models/vet_visit.rb +0 -5
- data/spec/app/models/video.rb +0 -13
- data/spec/app/models/weapon.rb +0 -11
- data/spec/app/models/word.rb +0 -12
- data/spec/app/models/word_origin.rb +0 -11
- data/spec/app/models/writer.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d194ed93d293b70ecc4c7fe0b2995877faf0835f
|
4
|
+
data.tar.gz: 14878b0db059da4ffc434aef035c67562d7d0595
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6230dbde5a463fafe0b96533dbb0c902ab80f00e2aebfddabfe48e172b3e52aeb9a193ef33aed01e7b093609c20d200f03de51b8f839cc82adae5afeed50e4a3
|
7
|
+
data.tar.gz: 76d4b005b89900ca07995148070f1a789a07fd5c9bd790531d7a0ca3b0b0fb712a9f90a0738b61369b97b9d9010d46b7550fb88466743cf9effd3259747df24a
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -32,6 +32,7 @@ module Mongoid
|
|
32
32
|
# @example Revise the document.
|
33
33
|
# person.revise
|
34
34
|
#
|
35
|
+
# @todo Remove Mongoid 4 support.
|
35
36
|
# @since 1.0.0
|
36
37
|
def revise
|
37
38
|
previous = previous_revision
|
@@ -44,8 +45,11 @@ module Mongoid
|
|
44
45
|
deleted = versions.first
|
45
46
|
if deleted.respond_to?(:paranoid?) && deleted.paranoid?
|
46
47
|
versions.delete_one(deleted)
|
47
|
-
|
48
|
-
|
48
|
+
|
49
|
+
query = collection.find(atomic_selector)
|
50
|
+
query.respond_to?(:update_one) ?
|
51
|
+
query.update_one({ "$pull" => { "versions" => { "version" => deleted.version }}}) :
|
52
|
+
query.update({ "$pull" => { "versions" => { "version" => deleted.version }}})
|
49
53
|
else
|
50
54
|
versions.delete(deleted)
|
51
55
|
end
|
@@ -127,11 +131,16 @@ module Mongoid
|
|
127
131
|
#
|
128
132
|
# @return [ Document, nil ] The previously saved document.
|
129
133
|
#
|
134
|
+
# @todo Remove Mongoid 4 support.
|
130
135
|
# @since 2.0.0
|
131
136
|
def previous_revision
|
137
|
+
options = self.respond_to?(:mongo_client) ?
|
138
|
+
self.mongo_client.options.symbolize_keys :
|
139
|
+
self.mongo_session.options
|
140
|
+
|
132
141
|
_loading_revision do
|
133
142
|
self.class.unscoped.
|
134
|
-
with(
|
143
|
+
with(options).
|
135
144
|
where(_id: id).
|
136
145
|
any_of({ version: version }, { version: nil }).first
|
137
146
|
end
|
data/mongoid-versioning.gemspec
CHANGED
@@ -13,9 +13,9 @@ Gem::Specification.new do |gem|
|
|
13
13
|
gem.files = `git ls-files`.split("\n")
|
14
14
|
gem.require_path = 'lib'
|
15
15
|
|
16
|
-
gem.add_dependency 'activesupport'
|
17
|
-
gem.add_dependency 'mongoid', '
|
18
|
-
gem.add_development_dependency 'mongoid-paranoia', '1.
|
16
|
+
gem.add_dependency 'activesupport', '~> 4.0'
|
17
|
+
gem.add_dependency 'mongoid', '>= 4.0.0', '<= 6.0.0'
|
18
|
+
gem.add_development_dependency 'mongoid-paranoia', '~> 1.1', '>= 1.1.0'
|
19
19
|
gem.add_development_dependency 'rake'
|
20
20
|
gem.add_development_dependency 'rspec', '~> 3'
|
21
21
|
end
|
data/spec/app/models/comment.rb
CHANGED
@@ -4,13 +4,13 @@ class Comment
|
|
4
4
|
field :title, type: String
|
5
5
|
field :text, type: String
|
6
6
|
|
7
|
-
belongs_to :account
|
8
|
-
belongs_to :movie
|
9
|
-
belongs_to :rating
|
7
|
+
# belongs_to :account
|
8
|
+
# belongs_to :movie
|
9
|
+
# belongs_to :rating
|
10
10
|
belongs_to :wiki_page
|
11
11
|
|
12
12
|
belongs_to :commentable, polymorphic: true
|
13
13
|
|
14
14
|
validates :title, presence: true
|
15
|
-
validates :movie, :rating, associated: true
|
15
|
+
# validates :movie, :rating, associated: true
|
16
16
|
end
|
@@ -194,7 +194,7 @@ describe Mongoid::Versioning do
|
|
194
194
|
let(:title) { "my new wiki" }
|
195
195
|
|
196
196
|
let!(:page) do
|
197
|
-
WikiPage.with(database:
|
197
|
+
WikiPage.with(database: database_id_alt).create!(description: "1",title: title)
|
198
198
|
end
|
199
199
|
|
200
200
|
context "when the document is persisted once" do
|
@@ -210,14 +210,14 @@ describe Mongoid::Versioning do
|
|
210
210
|
end
|
211
211
|
|
212
212
|
it "persists to specified database" do
|
213
|
-
expect(WikiPage.with(database:
|
213
|
+
expect(WikiPage.with(database: database_id_alt).find_by(title: title)).not_to be_nil
|
214
214
|
end
|
215
215
|
end
|
216
216
|
|
217
217
|
context "when the document is persisted more than once" do
|
218
218
|
|
219
219
|
before do
|
220
|
-
3.times { |n| page.with(database:
|
220
|
+
3.times { |n| page.with(database: database_id_alt).update_attribute(:description, "#{n}") }
|
221
221
|
end
|
222
222
|
|
223
223
|
it "returns the number of versions" do
|
@@ -225,13 +225,17 @@ describe Mongoid::Versioning do
|
|
225
225
|
end
|
226
226
|
|
227
227
|
it "persists to specified database" do
|
228
|
-
expect(WikiPage.with(database:
|
228
|
+
expect(WikiPage.with(database: database_id_alt).find_by(:title => title)).not_to be_nil
|
229
229
|
end
|
230
230
|
|
231
231
|
it "persists the versions to specified database" do
|
232
|
-
expect(WikiPage.with(database:
|
232
|
+
expect(WikiPage.with(database: database_id_alt).find_by(:title => title).version).to eq(4)
|
233
233
|
end
|
234
234
|
end
|
235
|
+
|
236
|
+
after do
|
237
|
+
WikiPage.with(database: database_id_alt).delete_all
|
238
|
+
end
|
235
239
|
end
|
236
240
|
end
|
237
241
|
|
data/spec/spec_helper.rb
CHANGED
@@ -18,8 +18,11 @@ ENV["MONGOID_SPEC_PORT"] ||= "27017"
|
|
18
18
|
HOST = ENV["MONGOID_SPEC_HOST"]
|
19
19
|
PORT = ENV["MONGOID_SPEC_PORT"].to_i
|
20
20
|
|
21
|
-
# Moped.logger.level = Logger::DEBUG
|
21
|
+
# Moped.logger.level = Logger::DEBUG # TODO Remove Mongoid 4 support.
|
22
22
|
# Mongoid.logger.level = Logger::DEBUG
|
23
|
+
if defined?(Mongo)
|
24
|
+
Mongo::Logger.logger.level = Logger::WARN
|
25
|
+
end
|
23
26
|
|
24
27
|
# When testing locally we use the database named mongoid_test. However when
|
25
28
|
# tests are running in parallel on Travis we need to use different database
|
@@ -29,6 +32,10 @@ def database_id
|
|
29
32
|
"mongoid_test"
|
30
33
|
end
|
31
34
|
|
35
|
+
def database_id_alt
|
36
|
+
"mongoid_test_alt"
|
37
|
+
end
|
38
|
+
|
32
39
|
# Can we connect to MongoHQ from this box?
|
33
40
|
def mongohq_connectable?
|
34
41
|
ENV["MONGOHQ_REPL_PASS"].present?
|
@@ -66,7 +73,12 @@ RSpec.configure do |config|
|
|
66
73
|
# drop the database after the suite.
|
67
74
|
config.after(:suite) do
|
68
75
|
if ENV["CI"]
|
69
|
-
|
76
|
+
if defined?(Mongo)
|
77
|
+
Mongo::Client.new(["#{HOST}:#{PORT}"], database: database_id).database.drop
|
78
|
+
Mongo::Client.new(["#{HOST}:#{PORT}"], database: database_id_alt).database.drop
|
79
|
+
else
|
80
|
+
Mongoid::Threaded.sessions[:default].drop
|
81
|
+
end
|
70
82
|
end
|
71
83
|
end
|
72
84
|
|
metadata
CHANGED
@@ -1,57 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid-versioning
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mario Uher
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
19
|
+
version: '4.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
26
|
+
version: '4.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: mongoid
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 4.0.0
|
34
|
+
- - "<="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 6.0.0
|
34
37
|
type: :runtime
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
|
-
- - "
|
41
|
+
- - ">="
|
39
42
|
- !ruby/object:Gem::Version
|
40
43
|
version: 4.0.0
|
44
|
+
- - "<="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 6.0.0
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: mongoid-paranoia
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
|
-
- -
|
51
|
+
- - "~>"
|
46
52
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
53
|
+
version: '1.1'
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 1.1.0
|
48
57
|
type: :development
|
49
58
|
prerelease: false
|
50
59
|
version_requirements: !ruby/object:Gem::Requirement
|
51
60
|
requirements:
|
52
|
-
- -
|
61
|
+
- - "~>"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '1.1'
|
64
|
+
- - ">="
|
53
65
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
66
|
+
version: 1.1.0
|
55
67
|
- !ruby/object:Gem::Dependency
|
56
68
|
name: rake
|
57
69
|
requirement: !ruby/object:Gem::Requirement
|
@@ -93,6 +105,8 @@ files:
|
|
93
105
|
- Gemfile
|
94
106
|
- README.md
|
95
107
|
- Rakefile
|
108
|
+
- gemfiles/Mongoid_4.gemfile
|
109
|
+
- gemfiles/Mongoid_5.gemfile
|
96
110
|
- lib/mongoid/config/locales/en.yml
|
97
111
|
- lib/mongoid/core_ext/errors/versioning_not_on_root.rb
|
98
112
|
- lib/mongoid/core_ext/fields/standard.rb
|
@@ -110,189 +124,14 @@ files:
|
|
110
124
|
- lib/mongoid/versioning.rb
|
111
125
|
- lib/mongoid/versioning/version.rb
|
112
126
|
- mongoid-versioning.gemspec
|
113
|
-
- spec/app/models/account.rb
|
114
|
-
- spec/app/models/acolyte.rb
|
115
|
-
- spec/app/models/actor.rb
|
116
|
-
- spec/app/models/actor_observer.rb
|
117
|
-
- spec/app/models/actress.rb
|
118
127
|
- spec/app/models/address.rb
|
119
128
|
- spec/app/models/address_component.rb
|
120
|
-
- spec/app/models/address_number.rb
|
121
|
-
- spec/app/models/agency.rb
|
122
|
-
- spec/app/models/agent.rb
|
123
|
-
- spec/app/models/album.rb
|
124
|
-
- spec/app/models/alert.rb
|
125
|
-
- spec/app/models/animal.rb
|
126
|
-
- spec/app/models/answer.rb
|
127
|
-
- spec/app/models/appointment.rb
|
128
|
-
- spec/app/models/article.rb
|
129
|
-
- spec/app/models/artist.rb
|
130
|
-
- spec/app/models/artwork.rb
|
131
|
-
- spec/app/models/augmentation.rb
|
132
129
|
- spec/app/models/author.rb
|
133
|
-
- spec/app/models/band.rb
|
134
|
-
- spec/app/models/bar.rb
|
135
|
-
- spec/app/models/basic.rb
|
136
|
-
- spec/app/models/bed.rb
|
137
|
-
- spec/app/models/big_palette.rb
|
138
|
-
- spec/app/models/birthday.rb
|
139
|
-
- spec/app/models/book.rb
|
140
|
-
- spec/app/models/breed.rb
|
141
|
-
- spec/app/models/browser.rb
|
142
|
-
- spec/app/models/building.rb
|
143
|
-
- spec/app/models/building_address.rb
|
144
|
-
- spec/app/models/bus.rb
|
145
|
-
- spec/app/models/business.rb
|
146
|
-
- spec/app/models/callback_recorder.rb
|
147
|
-
- spec/app/models/callback_test.rb
|
148
|
-
- spec/app/models/canvas.rb
|
149
|
-
- spec/app/models/car.rb
|
150
|
-
- spec/app/models/cat.rb
|
151
|
-
- spec/app/models/category.rb
|
152
|
-
- spec/app/models/child.rb
|
153
|
-
- spec/app/models/child_doc.rb
|
154
|
-
- spec/app/models/church.rb
|
155
|
-
- spec/app/models/circle.rb
|
156
|
-
- spec/app/models/circuit.rb
|
157
|
-
- spec/app/models/circus.rb
|
158
|
-
- spec/app/models/code.rb
|
159
130
|
- spec/app/models/comment.rb
|
160
|
-
- spec/app/models/contractor.rb
|
161
|
-
- spec/app/models/cookie.rb
|
162
|
-
- spec/app/models/country_code.rb
|
163
|
-
- spec/app/models/definition.rb
|
164
|
-
- spec/app/models/description.rb
|
165
|
-
- spec/app/models/dictionary.rb
|
166
|
-
- spec/app/models/division.rb
|
167
|
-
- spec/app/models/doctor.rb
|
168
|
-
- spec/app/models/dog.rb
|
169
|
-
- spec/app/models/dokument.rb
|
170
|
-
- spec/app/models/driver.rb
|
171
|
-
- spec/app/models/drug.rb
|
172
|
-
- spec/app/models/email.rb
|
173
|
-
- spec/app/models/employer.rb
|
174
|
-
- spec/app/models/entry.rb
|
175
|
-
- spec/app/models/eraser.rb
|
176
|
-
- spec/app/models/event.rb
|
177
|
-
- spec/app/models/exhibition.rb
|
178
|
-
- spec/app/models/exhibitor.rb
|
179
|
-
- spec/app/models/eye.rb
|
180
|
-
- spec/app/models/eye_bowl.rb
|
181
|
-
- spec/app/models/face.rb
|
182
|
-
- spec/app/models/favorite.rb
|
183
|
-
- spec/app/models/filesystem.rb
|
184
|
-
- spec/app/models/firefox.rb
|
185
|
-
- spec/app/models/fish.rb
|
186
|
-
- spec/app/models/folder.rb
|
187
|
-
- spec/app/models/folder_item.rb
|
188
|
-
- spec/app/models/fruits.rb
|
189
|
-
- spec/app/models/game.rb
|
190
|
-
- spec/app/models/ghost.rb
|
191
|
-
- spec/app/models/home.rb
|
192
|
-
- spec/app/models/house.rb
|
193
|
-
- spec/app/models/html_writer.rb
|
194
|
-
- spec/app/models/image.rb
|
195
|
-
- spec/app/models/implant.rb
|
196
|
-
- spec/app/models/item.rb
|
197
|
-
- spec/app/models/jar.rb
|
198
|
-
- spec/app/models/label.rb
|
199
|
-
- spec/app/models/language.rb
|
200
|
-
- spec/app/models/lat_lng.rb
|
201
|
-
- spec/app/models/league.rb
|
202
|
-
- spec/app/models/learner.rb
|
203
|
-
- spec/app/models/line_item.rb
|
204
|
-
- spec/app/models/location.rb
|
205
|
-
- spec/app/models/login.rb
|
206
|
-
- spec/app/models/manufacturer.rb
|
207
|
-
- spec/app/models/meat.rb
|
208
|
-
- spec/app/models/membership.rb
|
209
|
-
- spec/app/models/mixed_drink.rb
|
210
|
-
- spec/app/models/movie.rb
|
211
|
-
- spec/app/models/my_hash.rb
|
212
|
-
- spec/app/models/name.rb
|
213
|
-
- spec/app/models/node.rb
|
214
|
-
- spec/app/models/note.rb
|
215
|
-
- spec/app/models/ordered_post.rb
|
216
|
-
- spec/app/models/ordered_preference.rb
|
217
|
-
- spec/app/models/oscar.rb
|
218
|
-
- spec/app/models/override.rb
|
219
|
-
- spec/app/models/ownable.rb
|
220
|
-
- spec/app/models/owner.rb
|
221
|
-
- spec/app/models/page.rb
|
222
|
-
- spec/app/models/page_question.rb
|
223
|
-
- spec/app/models/palette.rb
|
224
|
-
- spec/app/models/paranoid_phone.rb
|
225
131
|
- spec/app/models/paranoid_post.rb
|
226
|
-
- spec/app/models/parent.rb
|
227
|
-
- spec/app/models/parent_doc.rb
|
228
|
-
- spec/app/models/passport.rb
|
229
|
-
- spec/app/models/patient.rb
|
230
|
-
- spec/app/models/pdf_writer.rb
|
231
|
-
- spec/app/models/pencil.rb
|
232
|
-
- spec/app/models/person.rb
|
233
|
-
- spec/app/models/pet.rb
|
234
|
-
- spec/app/models/pet_owner.rb
|
235
|
-
- spec/app/models/phone.rb
|
236
|
-
- spec/app/models/phone_observer.rb
|
237
|
-
- spec/app/models/pizza.rb
|
238
|
-
- spec/app/models/player.rb
|
239
|
-
- spec/app/models/post.rb
|
240
|
-
- spec/app/models/powerup.rb
|
241
|
-
- spec/app/models/preference.rb
|
242
|
-
- spec/app/models/princess.rb
|
243
|
-
- spec/app/models/product.rb
|
244
|
-
- spec/app/models/profile.rb
|
245
|
-
- spec/app/models/pronunciation.rb
|
246
|
-
- spec/app/models/purchase.rb
|
247
|
-
- spec/app/models/question.rb
|
248
|
-
- spec/app/models/quiz.rb
|
249
|
-
- spec/app/models/rating.rb
|
250
|
-
- spec/app/models/record.rb
|
251
|
-
- spec/app/models/registry.rb
|
252
|
-
- spec/app/models/role.rb
|
253
|
-
- spec/app/models/root_category.rb
|
254
|
-
- spec/app/models/sandwich.rb
|
255
|
-
- spec/app/models/scheduler.rb
|
256
|
-
- spec/app/models/seo.rb
|
257
|
-
- spec/app/models/series.rb
|
258
|
-
- spec/app/models/server.rb
|
259
|
-
- spec/app/models/service.rb
|
260
|
-
- spec/app/models/shape.rb
|
261
|
-
- spec/app/models/shelf.rb
|
262
|
-
- spec/app/models/shipping_container.rb
|
263
|
-
- spec/app/models/shop.rb
|
264
|
-
- spec/app/models/short_agent.rb
|
265
|
-
- spec/app/models/short_quiz.rb
|
266
|
-
- spec/app/models/slave.rb
|
267
|
-
- spec/app/models/song.rb
|
268
|
-
- spec/app/models/square.rb
|
269
|
-
- spec/app/models/strategy.rb
|
270
|
-
- spec/app/models/sub_item.rb
|
271
|
-
- spec/app/models/survey.rb
|
272
|
-
- spec/app/models/symptom.rb
|
273
132
|
- spec/app/models/tag.rb
|
274
|
-
- spec/app/models/target.rb
|
275
|
-
- spec/app/models/template.rb
|
276
|
-
- spec/app/models/thing.rb
|
277
133
|
- spec/app/models/title.rb
|
278
|
-
- spec/app/models/tool.rb
|
279
|
-
- spec/app/models/topping.rb
|
280
|
-
- spec/app/models/track.rb
|
281
|
-
- spec/app/models/translation.rb
|
282
|
-
- spec/app/models/tree.rb
|
283
|
-
- spec/app/models/truck.rb
|
284
|
-
- spec/app/models/user.rb
|
285
|
-
- spec/app/models/user_account.rb
|
286
|
-
- spec/app/models/validation_callback.rb
|
287
|
-
- spec/app/models/vehicle.rb
|
288
|
-
- spec/app/models/version.rb
|
289
|
-
- spec/app/models/vet_visit.rb
|
290
|
-
- spec/app/models/video.rb
|
291
|
-
- spec/app/models/weapon.rb
|
292
134
|
- spec/app/models/wiki_page.rb
|
293
|
-
- spec/app/models/word.rb
|
294
|
-
- spec/app/models/word_origin.rb
|
295
|
-
- spec/app/models/writer.rb
|
296
135
|
- spec/config/mongoid.yml
|
297
136
|
- spec/mongoid/errors/versioning_not_on_root_spec.rb
|
298
137
|
- spec/mongoid/relations/macros_spec.rb
|
data/spec/app/models/account.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
class Account
|
2
|
-
include Mongoid::Document
|
3
|
-
|
4
|
-
field :_id, type: String, default: ->{ name.try(:parameterize) }
|
5
|
-
|
6
|
-
field :number, type: String
|
7
|
-
field :balance, type: String
|
8
|
-
field :nickname, type: String
|
9
|
-
field :name, type: String
|
10
|
-
field :balanced, type: Boolean, default: ->{ balance? ? true : false }
|
11
|
-
|
12
|
-
field :overridden, type: String
|
13
|
-
|
14
|
-
embeds_many :memberships
|
15
|
-
belongs_to :creator, class_name: "User", foreign_key: :creator_id
|
16
|
-
belongs_to :person
|
17
|
-
has_many :alerts
|
18
|
-
has_and_belongs_to_many :agents
|
19
|
-
has_one :comment, validate: false
|
20
|
-
|
21
|
-
validates_presence_of :name
|
22
|
-
validates_presence_of :nickname, on: :upsert
|
23
|
-
validates_length_of :name, maximum: 10, on: :create
|
24
|
-
|
25
|
-
def overridden
|
26
|
-
self[:overridden] = "not recommended"
|
27
|
-
end
|
28
|
-
end
|
data/spec/app/models/acolyte.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
class Acolyte
|
2
|
-
include Mongoid::Document
|
3
|
-
field :status
|
4
|
-
field :name
|
5
|
-
|
6
|
-
embeds_many :versions, as: :memorable
|
7
|
-
belongs_to :church
|
8
|
-
|
9
|
-
default_scope ->{ asc(:name) }
|
10
|
-
scope :active, ->{ where(status: "active") }
|
11
|
-
scope :named, ->{ where(:name.exists => true) }
|
12
|
-
|
13
|
-
def callback_test?
|
14
|
-
name == "callback-test"
|
15
|
-
end
|
16
|
-
end
|
data/spec/app/models/actor.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
class Actor
|
2
|
-
include Mongoid::Document
|
3
|
-
field :name
|
4
|
-
field :after_custom_count, type: Integer, default: 0
|
5
|
-
has_and_belongs_to_many :tags
|
6
|
-
embeds_many :things, validate: false, cascade_callbacks: true
|
7
|
-
accepts_nested_attributes_for :things, allow_destroy: true
|
8
|
-
|
9
|
-
define_model_callbacks :custom
|
10
|
-
observable :custom
|
11
|
-
|
12
|
-
def do_something
|
13
|
-
run_callbacks(:custom) do
|
14
|
-
self.name = "custom"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
require "app/models/actress"
|
@@ -1,15 +0,0 @@
|
|
1
|
-
class ActorObserver < Mongoid::Observer
|
2
|
-
attr_reader :last_after_create_record
|
3
|
-
|
4
|
-
def after_create(record)
|
5
|
-
@last_after_create_record = record
|
6
|
-
end
|
7
|
-
|
8
|
-
def after_custom(record)
|
9
|
-
record.after_custom_count += 1
|
10
|
-
end
|
11
|
-
|
12
|
-
def before_custom(record)
|
13
|
-
@after_custom_called = true
|
14
|
-
end
|
15
|
-
end
|
data/spec/app/models/actress.rb
DELETED
data/spec/app/models/agency.rb
DELETED
data/spec/app/models/agent.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
class Agent
|
2
|
-
include Mongoid::Document
|
3
|
-
include Mongoid::Timestamps::Updated
|
4
|
-
field :title, type: String
|
5
|
-
field :number, type: String
|
6
|
-
field :dob, type: Time
|
7
|
-
embeds_many :names, as: :namable
|
8
|
-
belongs_to :game
|
9
|
-
belongs_to :agency, touch: true, autobuild: true
|
10
|
-
|
11
|
-
has_and_belongs_to_many :accounts
|
12
|
-
end
|
data/spec/app/models/album.rb
DELETED