mongoid-history 0.8.3 → 0.8.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/.coveralls.yml +1 -1
  3. data/.document +5 -5
  4. data/.github/workflows/test.yml +72 -0
  5. data/.gitignore +46 -46
  6. data/.rspec +2 -2
  7. data/.rubocop.yml +6 -6
  8. data/.rubocop_todo.yml +99 -99
  9. data/CHANGELOG.md +173 -163
  10. data/CONTRIBUTING.md +117 -118
  11. data/Dangerfile +1 -1
  12. data/Gemfile +49 -40
  13. data/LICENSE.txt +20 -20
  14. data/README.md +609 -608
  15. data/RELEASING.md +66 -67
  16. data/Rakefile +24 -24
  17. data/UPGRADING.md +53 -53
  18. data/lib/mongoid/history/attributes/base.rb +72 -72
  19. data/lib/mongoid/history/attributes/create.rb +45 -45
  20. data/lib/mongoid/history/attributes/destroy.rb +34 -34
  21. data/lib/mongoid/history/attributes/update.rb +104 -104
  22. data/lib/mongoid/history/options.rb +177 -177
  23. data/lib/mongoid/history/trackable.rb +588 -583
  24. data/lib/mongoid/history/tracker.rb +247 -247
  25. data/lib/mongoid/history/version.rb +5 -5
  26. data/lib/mongoid/history.rb +77 -77
  27. data/lib/mongoid-history.rb +1 -1
  28. data/mongoid-history.gemspec +25 -25
  29. data/perf/benchmark_modified_attributes_for_create.rb +65 -65
  30. data/perf/gc_suite.rb +21 -21
  31. data/spec/integration/embedded_in_polymorphic_spec.rb +112 -112
  32. data/spec/integration/integration_spec.rb +976 -976
  33. data/spec/integration/multi_relation_spec.rb +47 -47
  34. data/spec/integration/multiple_trackers_spec.rb +68 -68
  35. data/spec/integration/nested_embedded_documents_spec.rb +64 -64
  36. data/spec/integration/nested_embedded_documents_tracked_in_parent_spec.rb +124 -124
  37. data/spec/integration/nested_embedded_polymorphic_documents_spec.rb +115 -115
  38. data/spec/integration/subclasses_spec.rb +47 -47
  39. data/spec/integration/track_history_order_spec.rb +84 -84
  40. data/spec/integration/validation_failure_spec.rb +76 -76
  41. data/spec/spec_helper.rb +32 -30
  42. data/spec/support/error_helpers.rb +7 -0
  43. data/spec/support/mongoid.rb +11 -11
  44. data/spec/support/mongoid_history.rb +12 -12
  45. data/spec/unit/attributes/base_spec.rb +141 -141
  46. data/spec/unit/attributes/create_spec.rb +342 -342
  47. data/spec/unit/attributes/destroy_spec.rb +228 -228
  48. data/spec/unit/attributes/update_spec.rb +342 -342
  49. data/spec/unit/callback_options_spec.rb +165 -165
  50. data/spec/unit/embedded_methods_spec.rb +87 -87
  51. data/spec/unit/history_spec.rb +58 -58
  52. data/spec/unit/my_instance_methods_spec.rb +555 -555
  53. data/spec/unit/options_spec.rb +365 -365
  54. data/spec/unit/singleton_methods_spec.rb +406 -406
  55. data/spec/unit/store/default_store_spec.rb +11 -11
  56. data/spec/unit/store/request_store_spec.rb +13 -13
  57. data/spec/unit/trackable_spec.rb +1057 -987
  58. data/spec/unit/tracker_spec.rb +190 -190
  59. metadata +9 -7
  60. data/.travis.yml +0 -36
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f7558f1c6033e5350cdeb3732e385d483c7abfa71ffc7f89acfbba22befff97
4
- data.tar.gz: 71c5f5ab67e1bd040e14b040211b1acc5532449f048919c83adcb4e875f7eac4
3
+ metadata.gz: b67b16c71da971d65e59f55d4cca0a8200adef185bb57bb21392d7f18bc0d510
4
+ data.tar.gz: 111c75120df8aae5b5fb70b2a9e15df04d85aa8c469dca1798cc2b3679065d0a
5
5
  SHA512:
6
- metadata.gz: f528411205ca81444296803927b54c1bd1ef570611b2b4a9bb79f6e4165fb038c5b13ad5fb79c8adde96c62eaefa1142bf5f4c6b5f44d72a80743f38a0aa5d48
7
- data.tar.gz: 4149122d3f6c474f5f0105772fa64a9fe237d299005e97ad021e887f42687d1a81ede778c589070231319704b9c71e2f99a5e660d04c2581a078178e965b0425
6
+ metadata.gz: 17aeb35a1db7f39b3bf888d837f09f2390f77f5713df0a3c3027b7689631f9cac13f671d111ab95a476161348c1fd18494de6acc461d48339c4001d747e24a15
7
+ data.tar.gz: 7bd7e59b6c37dbf4d9fa1c559a35a1afe1ca59feb2048413e89f85353493fe7e431fb57a4d9b595d1eb6ab70f78e4544f528edf90aace350426c327c1568bc54
data/.coveralls.yml CHANGED
@@ -1 +1 @@
1
- service_name: travis-ci
1
+ service_name: travis-ci
data/.document CHANGED
@@ -1,5 +1,5 @@
1
- lib/**/*.rb
2
- bin/*
3
- -
4
- features/**/*.feature
5
- LICENSE.txt
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
@@ -0,0 +1,72 @@
1
+ name: CI RSpec Test
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ name: >-
8
+ ${{ matrix.ruby }}
9
+ env:
10
+ CI: true
11
+ TESTOPTS: -v
12
+ runs-on: ubuntu-latest
13
+ continue-on-error: ${{ matrix.experimental }}
14
+ strategy:
15
+ fail-fast: true
16
+ matrix:
17
+ ruby: [2.5, 2.6, 2.7, 3.0, jruby] # truffleruby
18
+ mongoid: [7]
19
+ experimental: [false]
20
+ include:
21
+ - ruby: 2.3
22
+ mongoid: 3
23
+ experimental: false
24
+ - ruby: 2.4
25
+ mongoid: 4
26
+ experimental: false
27
+ - ruby: 2.5
28
+ mongoid: 5
29
+ experimental: false
30
+ - ruby: 2.6
31
+ mongoid: 6
32
+ experimental: false
33
+ - ruby: 2.7
34
+ mongoid: 7.0
35
+ experimental: false
36
+ - ruby: 2.7
37
+ mongoid: 7.1
38
+ experimental: false
39
+ - ruby: 2.7
40
+ mongoid: 7.2
41
+ experimental: false
42
+ - ruby: 2.7
43
+ mongoid: 7.3
44
+ experimental: false
45
+ - ruby: head
46
+ mongoid: 7
47
+ experimental: true
48
+ - ruby: jruby-head
49
+ mongoid: 7
50
+ experimental: true
51
+ # - ruby: truffleruby-head
52
+ # mongoid: 7
53
+ # experimental: true
54
+ steps:
55
+ - name: repo checkout
56
+ uses: actions/checkout@v2
57
+ - name: start mongodb
58
+ uses: supercharge/mongodb-github-action@1.6.0
59
+ with:
60
+ mongodb-version: 4.4
61
+ mongodb-replica-set: rs0
62
+ - name: load ruby
63
+ uses: ruby/setup-ruby@v1
64
+ with:
65
+ ruby-version: ${{ matrix.ruby }}
66
+ bundler: 2
67
+ - name: bundle install
68
+ run: bundle install --jobs 4 --retry 3
69
+ - name: test
70
+ timeout-minutes: 10
71
+ run: bundle exec rake spec
72
+ continue-on-error: ${{ matrix.experimental }}
data/.gitignore CHANGED
@@ -1,46 +1,46 @@
1
- Gemfile.lock
2
-
3
- .rvmrc
4
-
5
- # rcov generated
6
- coverage
7
-
8
- # rdoc generated
9
- rdoc
10
-
11
- # yard generated
12
- doc
13
- .yardoc
14
-
15
- # bundler
16
- .bundle
17
-
18
- # jeweler generated
19
- pkg
20
-
21
- # Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
22
- #
23
- # * Create a file at ~/.gitignore
24
- # * Include files you want ignored
25
- # * Run: git config --global core.excludesfile ~/.gitignore
26
- #
27
- # After doing this, these files will be ignored in all your git projects,
28
- # saving you from having to 'pollute' every project you touch with them
29
- #
30
- # Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
31
- #
32
- # For MacOS:
33
- #
34
- #.DS_Store
35
- #
36
- # For TextMate
37
- #*.tmproj
38
- #tmtags
39
- #
40
- # For emacs:
41
- #*~
42
- #\#*
43
- #.\#*
44
- #
45
- # For vim:
46
- #*.swp
1
+ Gemfile.lock
2
+
3
+ .rvmrc
4
+
5
+ # rcov generated
6
+ coverage
7
+
8
+ # rdoc generated
9
+ rdoc
10
+
11
+ # yard generated
12
+ doc
13
+ .yardoc
14
+
15
+ # bundler
16
+ .bundle
17
+
18
+ # jeweler generated
19
+ pkg
20
+
21
+ # Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
22
+ #
23
+ # * Create a file at ~/.gitignore
24
+ # * Include files you want ignored
25
+ # * Run: git config --global core.excludesfile ~/.gitignore
26
+ #
27
+ # After doing this, these files will be ignored in all your git projects,
28
+ # saving you from having to 'pollute' every project you touch with them
29
+ #
30
+ # Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
31
+ #
32
+ # For MacOS:
33
+ #
34
+ #.DS_Store
35
+ #
36
+ # For TextMate
37
+ #*.tmproj
38
+ #tmtags
39
+ #
40
+ # For emacs:
41
+ #*~
42
+ #\#*
43
+ #.\#*
44
+ #
45
+ # For vim:
46
+ #*.swp
data/.rspec CHANGED
@@ -1,2 +1,2 @@
1
- --color
2
- --format=documentation
1
+ --color
2
+ --format=documentation
data/.rubocop.yml CHANGED
@@ -1,6 +1,6 @@
1
- AllCops:
2
- Exclude:
3
- - vendor/**/*
4
- - bin/**/*
5
-
6
- inherit_from: .rubocop_todo.yml
1
+ AllCops:
2
+ Exclude:
3
+ - vendor/**/*
4
+ - bin/**/*
5
+
6
+ inherit_from: .rubocop_todo.yml
data/.rubocop_todo.yml CHANGED
@@ -1,99 +1,99 @@
1
- # This configuration was generated by
2
- # `rubocop --auto-gen-config`
3
- # on 2020-04-10 17:25:32 -0500 using RuboCop version 0.48.1.
4
- # The point is for the user to remove these configuration records
5
- # one by one as the offenses are removed from the code base.
6
- # Note that changes in the inspected code, or installation of new
7
- # versions of RuboCop, may require this file to be generated again.
8
-
9
- # Offense count: 7
10
- # Configuration parameters: Include.
11
- # Include: **/Gemfile, **/gems.rb
12
- Bundler/DuplicatedGem:
13
- Exclude:
14
- - 'Gemfile'
15
-
16
- # Offense count: 3
17
- Lint/HandleExceptions:
18
- Exclude:
19
- - 'spec/unit/trackable_spec.rb'
20
-
21
- # Offense count: 3
22
- Lint/ParenthesesAsGroupedExpression:
23
- Exclude:
24
- - 'spec/integration/integration_spec.rb'
25
- - 'spec/integration/nested_embedded_polymorphic_documents_spec.rb'
26
-
27
- # Offense count: 22
28
- Metrics/AbcSize:
29
- Max: 52
30
-
31
- # Offense count: 122
32
- # Configuration parameters: CountComments, ExcludedMethods.
33
- Metrics/BlockLength:
34
- Max: 837
35
-
36
- # Offense count: 1
37
- # Configuration parameters: CountComments.
38
- Metrics/ClassLength:
39
- Max: 120
40
-
41
- # Offense count: 6
42
- Metrics/CyclomaticComplexity:
43
- Max: 13
44
-
45
- # Offense count: 412
46
- # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
47
- # URISchemes: http, https
48
- Metrics/LineLength:
49
- Max: 688
50
-
51
- # Offense count: 17
52
- # Configuration parameters: CountComments.
53
- Metrics/MethodLength:
54
- Max: 23
55
-
56
- # Offense count: 2
57
- # Configuration parameters: CountComments.
58
- Metrics/ModuleLength:
59
- Max: 191
60
-
61
- # Offense count: 6
62
- Metrics/PerceivedComplexity:
63
- Max: 15
64
-
65
- # Offense count: 15
66
- Style/Documentation:
67
- Exclude:
68
- - 'spec/**/*'
69
- - 'test/**/*'
70
- - 'lib/mongoid/history.rb'
71
- - 'lib/mongoid/history/attributes/base.rb'
72
- - 'lib/mongoid/history/attributes/create.rb'
73
- - 'lib/mongoid/history/attributes/destroy.rb'
74
- - 'lib/mongoid/history/attributes/update.rb'
75
- - 'lib/mongoid/history/options.rb'
76
- - 'lib/mongoid/history/trackable.rb'
77
- - 'lib/mongoid/history/tracker.rb'
78
- - 'perf/benchmark_modified_attributes_for_create.rb'
79
- - 'perf/gc_suite.rb'
80
-
81
- # Offense count: 3
82
- # Cop supports --auto-correct.
83
- Style/EachWithObject:
84
- Exclude:
85
- - 'lib/mongoid/history/trackable.rb'
86
- - 'lib/mongoid/history/tracker.rb'
87
-
88
- # Offense count: 2
89
- # Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
90
- # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
91
- Style/FileName:
92
- Exclude:
93
- - 'Dangerfile'
94
- - 'lib/mongoid-history.rb'
95
-
96
- # Offense count: 1
97
- Style/MultilineBlockChain:
98
- Exclude:
99
- - 'lib/mongoid/history/tracker.rb'
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2020-04-10 17:25:32 -0500 using RuboCop version 0.48.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 7
10
+ # Configuration parameters: Include.
11
+ # Include: **/Gemfile, **/gems.rb
12
+ Bundler/DuplicatedGem:
13
+ Exclude:
14
+ - 'Gemfile'
15
+
16
+ # Offense count: 3
17
+ Lint/HandleExceptions:
18
+ Exclude:
19
+ - 'spec/unit/trackable_spec.rb'
20
+
21
+ # Offense count: 3
22
+ Lint/ParenthesesAsGroupedExpression:
23
+ Exclude:
24
+ - 'spec/integration/integration_spec.rb'
25
+ - 'spec/integration/nested_embedded_polymorphic_documents_spec.rb'
26
+
27
+ # Offense count: 22
28
+ Metrics/AbcSize:
29
+ Max: 52
30
+
31
+ # Offense count: 122
32
+ # Configuration parameters: CountComments, ExcludedMethods.
33
+ Metrics/BlockLength:
34
+ Max: 900
35
+
36
+ # Offense count: 1
37
+ # Configuration parameters: CountComments.
38
+ Metrics/ClassLength:
39
+ Max: 120
40
+
41
+ # Offense count: 6
42
+ Metrics/CyclomaticComplexity:
43
+ Max: 13
44
+
45
+ # Offense count: 412
46
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
47
+ # URISchemes: http, https
48
+ Metrics/LineLength:
49
+ Max: 688
50
+
51
+ # Offense count: 17
52
+ # Configuration parameters: CountComments.
53
+ Metrics/MethodLength:
54
+ Max: 23
55
+
56
+ # Offense count: 2
57
+ # Configuration parameters: CountComments.
58
+ Metrics/ModuleLength:
59
+ Max: 200
60
+
61
+ # Offense count: 6
62
+ Metrics/PerceivedComplexity:
63
+ Max: 15
64
+
65
+ # Offense count: 15
66
+ Style/Documentation:
67
+ Exclude:
68
+ - 'spec/**/*'
69
+ - 'test/**/*'
70
+ - 'lib/mongoid/history.rb'
71
+ - 'lib/mongoid/history/attributes/base.rb'
72
+ - 'lib/mongoid/history/attributes/create.rb'
73
+ - 'lib/mongoid/history/attributes/destroy.rb'
74
+ - 'lib/mongoid/history/attributes/update.rb'
75
+ - 'lib/mongoid/history/options.rb'
76
+ - 'lib/mongoid/history/trackable.rb'
77
+ - 'lib/mongoid/history/tracker.rb'
78
+ - 'perf/benchmark_modified_attributes_for_create.rb'
79
+ - 'perf/gc_suite.rb'
80
+
81
+ # Offense count: 3
82
+ # Cop supports --auto-correct.
83
+ Style/EachWithObject:
84
+ Exclude:
85
+ - 'lib/mongoid/history/trackable.rb'
86
+ - 'lib/mongoid/history/tracker.rb'
87
+
88
+ # Offense count: 2
89
+ # Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
90
+ # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
91
+ Style/FileName:
92
+ Exclude:
93
+ - 'Dangerfile'
94
+ - 'lib/mongoid-history.rb'
95
+
96
+ # Offense count: 1
97
+ Style/MultilineBlockChain:
98
+ Exclude:
99
+ - 'lib/mongoid/history/tracker.rb'