mongoid-history 0.8.3 → 0.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
data/CONTRIBUTING.md CHANGED
@@ -1,118 +1,117 @@
1
- Contributing to Mongoid-History
2
- ===============================
3
-
4
- Mongoid-History is work of [many of contributors](https://github.com/mongoid/mongoid-history/graphs/contributors). You're encouraged to submit [pull requests](https://github.com/mongoid/mongoid-history/pulls), [propose features, ask questions and discuss issues](https://github.com/mongoid/mongoid-history/issues).
5
-
6
- #### Fork the Project
7
-
8
- Fork the [project on Github](https://github.com/mongoid/mongoid-history) and check out your copy.
9
-
10
- ```
11
- git clone https://github.com/contributor/mongoid-history.git
12
- cd mongoid-history
13
- git remote add upstream https://github.com/mongoid/mongoid-history.git
14
- ```
15
-
16
- #### Create a Topic Branch
17
-
18
- Make sure your fork is up-to-date and create a topic branch for your feature or bug fix.
19
-
20
- ```
21
- git checkout master
22
- git pull upstream master
23
- git checkout -b my-feature-branch
24
- ```
25
-
26
- #### Bundle Install and Test
27
-
28
- Ensure that you can build the project and run tests.
29
-
30
- ```
31
- bundle install
32
- bundle exec rake
33
- ```
34
-
35
- #### Write Tests
36
-
37
- Try to write a test that reproduces the problem you're trying to fix or describes a feature that you want to build. Add to [spec/mongoid-history](spec/mongoid-history).
38
-
39
- We definitely appreciate pull requests that highlight or reproduce a problem, even without a fix.
40
-
41
- #### Write Code
42
-
43
- Implement your feature or bug fix.
44
-
45
- Ruby style is enforced with [Rubocop](https://github.com/bbatsov/rubocop), run `bundle exec rubocop` and fix any style issues highlighted.
46
-
47
- Make sure that `bundle exec rake` completes without errors.
48
-
49
- #### Write Documentation
50
-
51
- Document any external behavior in the [README](README.md).
52
-
53
- #### Update Changelog
54
-
55
- Add a line to [CHANGELOG](CHANGELOG.md) under *Next Release*. Make it look like every other line, including your name and link to your Github account.
56
-
57
- #### Commit Changes
58
-
59
- Make sure git knows your name and email address:
60
-
61
- ```
62
- git config --global user.name "Your Name"
63
- git config --global user.email "contributor@example.com"
64
- ```
65
-
66
- Writing good commit logs is important. A commit log should describe what changed and why.
67
-
68
- ```
69
- git add ...
70
- git commit
71
- ```
72
-
73
- #### Push
74
-
75
- ```
76
- git push origin my-feature-branch
77
- ```
78
-
79
- #### Make a Pull Request
80
-
81
- Go to https://github.com/contributor/mongoid-history and select your feature branch. Click the 'Pull Request' button and fill out the form. Pull requests are usually reviewed within a few days.
82
-
83
- #### Rebase
84
-
85
- If you've been working on a change for a while, rebase with upstream/master.
86
-
87
- ```
88
- git fetch upstream
89
- git rebase upstream/master
90
- git push origin my-feature-branch -f
91
- ```
92
-
93
- #### Update CHANGELOG Again
94
-
95
- Update the [CHANGELOG](CHANGELOG.md) with the pull request number. A typical entry looks as follows.
96
-
97
- ```
98
- * [#123](https://github.com/mongoid/mongoid-history/pull/123): Reticulated splines - [@contributor](https://github.com/contributor).
99
- ```
100
-
101
- Amend your previous commit and force push the changes.
102
-
103
- ```
104
- git commit --amend
105
- git push origin my-feature-branch -f
106
- ```
107
-
108
- #### Check on Your Pull Request
109
-
110
- Go back to your pull request after a few minutes and see whether it passed muster with Travis-CI. Everything should look green, otherwise fix issues and amend your commit as described above.
111
-
112
- #### Be Patient
113
-
114
- It's likely that your change will not be merged and that the nitpicky maintainers will ask you to do more, or fix seemingly benign problems. Hang on there!
115
-
116
- #### Thank You
117
-
118
- Please do know that we really appreciate and value your time and work. We love you, really.
1
+ # Contributing to Mongoid-History
2
+
3
+ Mongoid-History is work of [many of contributors](https://github.com/mongoid/mongoid-history/graphs/contributors). You're encouraged to submit [pull requests](https://github.com/mongoid/mongoid-history/pulls), [propose features, ask questions and discuss issues](https://github.com/mongoid/mongoid-history/issues).
4
+
5
+ ### Fork the Project
6
+
7
+ Fork the [project on Github](https://github.com/mongoid/mongoid-history) and check out your copy.
8
+
9
+ ```
10
+ git clone https://github.com/contributor/mongoid-history.git
11
+ cd mongoid-history
12
+ git remote add upstream https://github.com/mongoid/mongoid-history.git
13
+ ```
14
+
15
+ ### Create a Topic Branch
16
+
17
+ Make sure your fork is up-to-date and create a topic branch for your feature or bug fix.
18
+
19
+ ```
20
+ git checkout master
21
+ git pull upstream master
22
+ git checkout -b my-feature-branch
23
+ ```
24
+
25
+ ### Bundle Install and Test
26
+
27
+ Ensure that you can build the project and run tests.
28
+
29
+ ```
30
+ bundle install
31
+ bundle exec rake
32
+ ```
33
+
34
+ ### Write Tests
35
+
36
+ Try to write a test that reproduces the problem you're trying to fix or describes a feature that you want to build. Add to [spec/mongoid-history](spec/mongoid-history).
37
+
38
+ We definitely appreciate pull requests that highlight or reproduce a problem, even without a fix.
39
+
40
+ ### Write Code
41
+
42
+ Implement your feature or bug fix.
43
+
44
+ Ruby style is enforced with [Rubocop](https://github.com/bbatsov/rubocop), run `bundle exec rubocop` and fix any style issues highlighted.
45
+
46
+ Make sure that `bundle exec rake` completes without errors.
47
+
48
+ ### Write Documentation
49
+
50
+ Document any external behavior in the [README](README.md).
51
+
52
+ ### Update Changelog
53
+
54
+ Add a line to [CHANGELOG](CHANGELOG.md) under *Next Release*. Make it look like every other line, including your name and link to your Github account.
55
+
56
+ ### Commit Changes
57
+
58
+ Make sure git knows your name and email address:
59
+
60
+ ```
61
+ git config --global user.name "Your Name"
62
+ git config --global user.email "contributor@example.com"
63
+ ```
64
+
65
+ Writing good commit logs is important. A commit log should describe what changed and why.
66
+
67
+ ```
68
+ git add ...
69
+ git commit
70
+ ```
71
+
72
+ ### Push
73
+
74
+ ```
75
+ git push origin my-feature-branch
76
+ ```
77
+
78
+ ### Make a Pull Request
79
+
80
+ Go to https://github.com/contributor/mongoid-history and select your feature branch. Click the 'Pull Request' button and fill out the form. Pull requests are usually reviewed within a few days.
81
+
82
+ ### Rebase
83
+
84
+ If you've been working on a change for a while, rebase with upstream/master.
85
+
86
+ ```
87
+ git fetch upstream
88
+ git rebase upstream/master
89
+ git push origin my-feature-branch -f
90
+ ```
91
+
92
+ ### Update CHANGELOG Again
93
+
94
+ Update the [CHANGELOG](CHANGELOG.md) with the pull request number. A typical entry looks as follows.
95
+
96
+ ```
97
+ * [#123](https://github.com/mongoid/mongoid-history/pull/123): Reticulated splines - [@contributor](https://github.com/contributor).
98
+ ```
99
+
100
+ Amend your previous commit and force push the changes.
101
+
102
+ ```
103
+ git commit --amend
104
+ git push origin my-feature-branch -f
105
+ ```
106
+
107
+ ### Check on Your Pull Request
108
+
109
+ Go back to your pull request after a few minutes and see whether it passed muster with Travis-CI. Everything should look green, otherwise fix issues and amend your commit as described above.
110
+
111
+ ### Be Patient
112
+
113
+ It's likely that your change will not be merged and that the nitpicky maintainers will ask you to do more, or fix seemingly benign problems. Hang on there!
114
+
115
+ ### Thank You
116
+
117
+ Please do know that we really appreciate and value your time and work. We love you, really.
data/Dangerfile CHANGED
@@ -1 +1 @@
1
- danger.import_dangerfile(gem: 'mongoid-danger')
1
+ danger.import_dangerfile(gem: 'mongoid-danger')
data/Gemfile CHANGED
@@ -1,40 +1,49 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
4
-
5
- case version = ENV['MONGOID_VERSION'] || '~> 7.0.0'
6
- when 'HEAD'
7
- gem 'mongoid', github: 'mongodb/mongoid'
8
- when /\b7/
9
- gem 'mongoid', '~> 7.0.0'
10
- when /\b6/
11
- gem 'mongoid', '~> 6.0.0'
12
- when /\b5/
13
- gem 'mongoid', '~> 5.0'
14
- gem 'mongoid-observers', '~> 0.2.0'
15
- when /\b4/
16
- gem 'mongoid', '~> 4.0'
17
- gem 'mongoid-observers', '~> 0.2.0'
18
- when /\b3/
19
- gem 'mongoid', '~> 3.1.7'
20
- else
21
- gem 'mongoid', version
22
- end
23
- gem 'mongoid-compatibility'
24
-
25
- group :development, :test do
26
- gem 'bundler'
27
- gem 'pry'
28
- gem 'rake', '< 11.0'
29
- end
30
-
31
- group :test do
32
- gem 'benchmark-ips', require: false
33
- gem 'coveralls'
34
- gem 'gem-release'
35
- gem 'mongoid-danger', '~> 0.1.0', require: false
36
- gem 'request_store'
37
- gem 'rspec', '~> 3.1'
38
- gem 'rubocop', '0.48.1'
39
- gem 'yard'
40
- end
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ case version = ENV['MONGOID_VERSION'] || '~> 7.0'
6
+ when 'HEAD'
7
+ gem 'mongoid', github: 'mongodb/mongoid'
8
+ when '7'
9
+ gem 'mongoid', '~> 7.3'
10
+ when '7.3'
11
+ gem 'mongoid', '~> 7.3.0'
12
+ when '7.2'
13
+ gem 'mongoid', '~> 7.2.0'
14
+ when '7.1'
15
+ gem 'mongoid', '~> 7.1.0'
16
+ when '7.0'
17
+ gem 'mongoid', '~> 7.0.0'
18
+ when '6'
19
+ gem 'mongoid', '~> 6.0'
20
+ when '5'
21
+ gem 'mongoid', '~> 5.0'
22
+ gem 'mongoid-observers', '~> 0.2'
23
+ when '4'
24
+ gem 'mongoid', '~> 4.0'
25
+ gem 'mongoid-observers', '~> 0.2'
26
+ when '3'
27
+ gem 'mongoid', '~> 3.1'
28
+ else
29
+ gem 'mongoid', version
30
+ end
31
+
32
+ gem 'mongoid-compatibility'
33
+
34
+ group :development, :test do
35
+ gem 'bundler'
36
+ gem 'pry'
37
+ gem 'rake'
38
+ end
39
+
40
+ group :test do
41
+ gem 'benchmark-ips', require: false
42
+ gem 'coveralls'
43
+ gem 'gem-release'
44
+ gem 'mongoid-danger', '~> 0.1.0', require: false
45
+ gem 'request_store'
46
+ gem 'rspec', '~> 3.1'
47
+ gem 'rubocop', '0.48.1'
48
+ gem 'yard'
49
+ end
data/LICENSE.txt CHANGED
@@ -1,20 +1,20 @@
1
- Copyright (c) 2011-2018 Aaron Qian & Contributors
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ Copyright (c) 2011-2020 Aaron Qian & Contributors
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.