mongoid-versioning 0.2.0 → 1.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +20 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +2 -1
- data/README.md +2 -1
- data/Rakefile +3 -5
- data/gemfiles/mongoid_master.gemfile +8 -0
- data/lib/mongoid/config/locales/en.yml +11 -0
- data/lib/mongoid/core_ext/errors/versioning_not_on_root.rb +23 -0
- data/lib/mongoid/core_ext/fields/standard.rb +17 -0
- data/lib/mongoid/core_ext/fields/validators/macro.rb +11 -0
- data/lib/mongoid/core_ext/hierarchy.rb +25 -0
- data/lib/mongoid/core_ext/relations/bindings/embedded/many.rb +31 -0
- data/lib/mongoid/core_ext/relations/cascading.rb +23 -0
- data/lib/mongoid/core_ext/relations/embedded/batchable.rb +36 -0
- data/lib/mongoid/core_ext/relations/embedded/many.rb +24 -0
- data/lib/mongoid/core_ext/relations/macros.rb +39 -0
- data/lib/mongoid/core_ext/relations/metadata.rb +63 -0
- data/lib/mongoid/core_ext/relations/options.rb +9 -0
- data/lib/mongoid/core_ext/threaded/lifecycle.rb +37 -0
- data/lib/mongoid/core_ext/versioning.rb +218 -0
- data/lib/mongoid/versioning/version.rb +1 -1
- data/lib/mongoid/versioning.rb +16 -213
- data/mongoid-versioning.gemspec +2 -2
- data/spec/app/models/account.rb +0 -4
- data/spec/app/models/acolyte.rb +1 -1
- data/spec/app/models/address.rb +2 -2
- data/spec/app/models/appointment.rb +1 -1
- data/spec/app/models/article.rb +0 -3
- data/spec/app/models/building.rb +0 -2
- data/spec/app/models/building_address.rb +0 -2
- data/spec/app/models/contractor.rb +0 -2
- data/spec/app/models/dog.rb +1 -1
- data/spec/app/models/drug.rb +0 -2
- data/spec/app/models/event.rb +1 -1
- data/spec/app/models/game.rb +0 -2
- data/spec/app/models/house.rb +1 -2
- data/spec/app/models/item.rb +0 -4
- data/spec/app/models/name.rb +0 -2
- data/spec/app/models/paranoid_phone.rb +2 -0
- data/spec/app/models/paranoid_post.rb +3 -1
- data/spec/app/models/person.rb +3 -5
- data/spec/app/models/player.rb +2 -2
- data/spec/app/models/post.rb +2 -2
- data/spec/app/models/preference.rb +1 -1
- data/spec/app/models/quiz.rb +0 -3
- data/spec/app/models/registry.rb +1 -1
- data/spec/app/models/symptom.rb +1 -1
- data/spec/app/models/tree.rb +1 -1
- data/spec/app/models/video.rb +1 -5
- data/spec/app/models/wiki_page.rb +0 -2
- data/spec/config/mongoid.yml +0 -5
- data/spec/mongoid/errors/versioning_not_on_root_spec.rb +29 -0
- data/spec/mongoid/relations/macros_spec.rb +17 -0
- data/spec/mongoid/relations/metadata_spec.rb +50 -0
- data/spec/mongoid/versioning_spec.rb +2 -36
- data/spec/spec_helper.rb +4 -3
- metadata +44 -30
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require_relative "../spec_helper"
|
2
2
|
|
3
3
|
describe Mongoid::Versioning do
|
4
4
|
|
@@ -112,7 +112,7 @@ describe Mongoid::Versioning do
|
|
112
112
|
|
113
113
|
before :all do
|
114
114
|
class WikiPage
|
115
|
-
default_scope where(author: "Jim")
|
115
|
+
default_scope -> { where(author: "Jim") }
|
116
116
|
end
|
117
117
|
end
|
118
118
|
|
@@ -503,38 +503,4 @@ describe Mongoid::Versioning do
|
|
503
503
|
page.reload.child_pages.should eq([ child ])
|
504
504
|
end
|
505
505
|
end
|
506
|
-
|
507
|
-
context "when the identity map is enabled" do
|
508
|
-
|
509
|
-
before do
|
510
|
-
Mongoid.identity_map_enabled = true
|
511
|
-
end
|
512
|
-
|
513
|
-
after do
|
514
|
-
Mongoid.identity_map_enabled = false
|
515
|
-
end
|
516
|
-
|
517
|
-
context "when updating a loaded attribute" do
|
518
|
-
|
519
|
-
let!(:page) do
|
520
|
-
WikiPage.create(title: "first")
|
521
|
-
end
|
522
|
-
|
523
|
-
let!(:loaded) do
|
524
|
-
WikiPage.find(page.id)
|
525
|
-
end
|
526
|
-
|
527
|
-
before do
|
528
|
-
loaded.update_attribute(:title, "revised")
|
529
|
-
end
|
530
|
-
|
531
|
-
let(:reloaded) do
|
532
|
-
WikiPage.find(page.id)
|
533
|
-
end
|
534
|
-
|
535
|
-
it "returns the revised im memory document" do
|
536
|
-
reloaded.title.should eq("revised")
|
537
|
-
end
|
538
|
-
end
|
539
|
-
end
|
540
506
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -7,6 +7,8 @@ $LOAD_PATH.unshift(MODELS)
|
|
7
7
|
require "mongoid"
|
8
8
|
require "rspec"
|
9
9
|
|
10
|
+
require "mongoid/versioning"
|
11
|
+
|
10
12
|
# These environment variables can be set if wanting to test against a database
|
11
13
|
# that is not on the local machine.
|
12
14
|
ENV["MONGOID_SPEC_HOST"] ||= "localhost"
|
@@ -34,7 +36,7 @@ end
|
|
34
36
|
|
35
37
|
# Set the database that the spec suite connects to.
|
36
38
|
Mongoid.configure do |config|
|
37
|
-
config.connect_to(database_id
|
39
|
+
config.connect_to(database_id)
|
38
40
|
end
|
39
41
|
|
40
42
|
# Autoload every model for the test suite that sits in spec/app/models.
|
@@ -55,10 +57,9 @@ end
|
|
55
57
|
|
56
58
|
RSpec.configure do |config|
|
57
59
|
|
58
|
-
# Drop all collections
|
60
|
+
# Drop all collections before each spec.
|
59
61
|
config.before(:each) do
|
60
62
|
Mongoid.purge!
|
61
|
-
Mongoid::IdentityMap.clear
|
62
63
|
end
|
63
64
|
|
64
65
|
# On travis we are creating many different databases on each test run. We
|
metadata
CHANGED
@@ -1,48 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid-versioning
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
version: 0.2.0
|
4
|
+
version: 1.0.0.beta1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Mario Uher
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-04-09 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
|
-
prerelease: false
|
16
|
-
version_requirements: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - ! '>='
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: '3.0'
|
21
|
-
none: false
|
22
|
-
type: :runtime
|
23
14
|
name: activesupport
|
24
15
|
requirement: !ruby/object:Gem::Requirement
|
25
16
|
requirements:
|
26
|
-
- -
|
17
|
+
- - ">="
|
27
18
|
- !ruby/object:Gem::Version
|
28
|
-
version: '
|
29
|
-
|
30
|
-
- !ruby/object:Gem::Dependency
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
31
21
|
prerelease: false
|
32
22
|
version_requirements: !ruby/object:Gem::Requirement
|
33
23
|
requirements:
|
34
|
-
- -
|
24
|
+
- - ">="
|
35
25
|
- !ruby/object:Gem::Version
|
36
|
-
version: '
|
37
|
-
|
38
|
-
type: :runtime
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
39
28
|
name: mongoid
|
40
29
|
requirement: !ruby/object:Gem::Requirement
|
41
30
|
requirements:
|
42
|
-
- -
|
31
|
+
- - '='
|
43
32
|
- !ruby/object:Gem::Version
|
44
|
-
version:
|
45
|
-
|
33
|
+
version: 4.0.0.beta1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 4.0.0.beta1
|
46
41
|
description: Mongoid supports simple versioning through inclusion of the Mongoid::Versioning
|
47
42
|
module.
|
48
43
|
email: uher.mario@gmail.com
|
@@ -50,11 +45,27 @@ executables: []
|
|
50
45
|
extensions: []
|
51
46
|
extra_rdoc_files: []
|
52
47
|
files:
|
53
|
-
- .gitignore
|
48
|
+
- ".gitignore"
|
49
|
+
- ".travis.yml"
|
54
50
|
- CHANGELOG.md
|
55
51
|
- Gemfile
|
56
52
|
- README.md
|
57
53
|
- Rakefile
|
54
|
+
- gemfiles/mongoid_master.gemfile
|
55
|
+
- lib/mongoid/config/locales/en.yml
|
56
|
+
- lib/mongoid/core_ext/errors/versioning_not_on_root.rb
|
57
|
+
- lib/mongoid/core_ext/fields/standard.rb
|
58
|
+
- lib/mongoid/core_ext/fields/validators/macro.rb
|
59
|
+
- lib/mongoid/core_ext/hierarchy.rb
|
60
|
+
- lib/mongoid/core_ext/relations/bindings/embedded/many.rb
|
61
|
+
- lib/mongoid/core_ext/relations/cascading.rb
|
62
|
+
- lib/mongoid/core_ext/relations/embedded/batchable.rb
|
63
|
+
- lib/mongoid/core_ext/relations/embedded/many.rb
|
64
|
+
- lib/mongoid/core_ext/relations/macros.rb
|
65
|
+
- lib/mongoid/core_ext/relations/metadata.rb
|
66
|
+
- lib/mongoid/core_ext/relations/options.rb
|
67
|
+
- lib/mongoid/core_ext/threaded/lifecycle.rb
|
68
|
+
- lib/mongoid/core_ext/versioning.rb
|
58
69
|
- lib/mongoid/versioning.rb
|
59
70
|
- lib/mongoid/versioning/version.rb
|
60
71
|
- mongoid-versioning.gemspec
|
@@ -242,30 +253,33 @@ files:
|
|
242
253
|
- spec/app/models/word_origin.rb
|
243
254
|
- spec/app/models/writer.rb
|
244
255
|
- spec/config/mongoid.yml
|
256
|
+
- spec/mongoid/errors/versioning_not_on_root_spec.rb
|
257
|
+
- spec/mongoid/relations/macros_spec.rb
|
258
|
+
- spec/mongoid/relations/metadata_spec.rb
|
245
259
|
- spec/mongoid/versioning_spec.rb
|
246
260
|
- spec/spec_helper.rb
|
247
261
|
homepage: https://github.com/haihappen/mongoid-versioning
|
248
262
|
licenses: []
|
263
|
+
metadata: {}
|
249
264
|
post_install_message:
|
250
265
|
rdoc_options: []
|
251
266
|
require_paths:
|
252
267
|
- lib
|
253
268
|
required_ruby_version: !ruby/object:Gem::Requirement
|
254
269
|
requirements:
|
255
|
-
- -
|
270
|
+
- - ">="
|
256
271
|
- !ruby/object:Gem::Version
|
257
272
|
version: '0'
|
258
|
-
none: false
|
259
273
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
260
274
|
requirements:
|
261
|
-
- -
|
275
|
+
- - ">"
|
262
276
|
- !ruby/object:Gem::Version
|
263
|
-
version:
|
264
|
-
none: false
|
277
|
+
version: 1.3.1
|
265
278
|
requirements: []
|
266
279
|
rubyforge_project:
|
267
|
-
rubygems_version:
|
280
|
+
rubygems_version: 2.2.0
|
268
281
|
signing_key:
|
269
|
-
specification_version:
|
282
|
+
specification_version: 4
|
270
283
|
summary: Extraction of mongoid-versioning into its own gem.
|
271
284
|
test_files: []
|
285
|
+
has_rdoc:
|