mongoid-locker 2.0.0 → 2.0.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 83a2fc5d9474fb911afd4cb106587e84aa7209ee8875b578feaabdff226c3be1
4
- data.tar.gz: 8bdfc514dd4649646ea3de44ebf0892b6b9b74a83aadffd5d2c5694177842ba6
3
+ metadata.gz: 4dc56290fe20687a98a9a031da8334d833f76b64ce44ae28efb1a8facf5db9eb
4
+ data.tar.gz: a8c1dccc297c272bc46182e9adc5409c9d9d8add0fd66492bad3344811a896f3
5
5
  SHA512:
6
- metadata.gz: fdd9b3d0ad671dd6b2bbf862f47cb7b642446d2f8642861de0d755ee7143e61eb60e3a3f6614f235ed79c09085ff408c4f1a4f39707379c358e655748229866c
7
- data.tar.gz: 2cb5ec0046da6f2d6f7b58e8bac93ea6297da9ae3279281b68b0528ebe527b0e6b928db29a280e3282e19c34d16b1e289e6947ab45f1bf33c70bf6864ccc4c9d
6
+ metadata.gz: b73d8474bbdc7f106ff2d562614937c9cfeb1c925a3d6dd01f7d50cc57ffca2e742ff34c6c192f6cde7e86a9766939b4aa96b10e280a4e5a6109180aa981e793
7
+ data.tar.gz: 8d31f7452bd7d83bf2c54373c309698135f066a32bf006b608fc70fb1caf0bfed15fc6c38b1cc08b7e804ed0cbf1c27bc691b32997331c2e035a3408b383d57a
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2019-10-23 10:17:29 -0400 using RuboCop version 0.75.1.
3
+ # on 2020-04-05 22:21:29 +0300 using RuboCop version 0.81.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -13,15 +13,21 @@ Bundler/DuplicatedGem:
13
13
  Exclude:
14
14
  - 'Gemfile'
15
15
 
16
+ # Offense count: 2
17
+ Lint/AmbiguousBlockAssociation:
18
+ Exclude:
19
+ - 'spec/test_examples_spec.rb'
20
+
16
21
  # Offense count: 4
22
+ # Configuration parameters: IgnoredMethods.
17
23
  Metrics/AbcSize:
18
- Max: 21
24
+ Max: 24
19
25
 
20
- # Offense count: 10
26
+ # Offense count: 11
21
27
  # Configuration parameters: CountComments, ExcludedMethods.
22
28
  # ExcludedMethods: refine
23
29
  Metrics/BlockLength:
24
- Max: 292
30
+ Max: 290
25
31
 
26
32
  # Offense count: 5
27
33
  # Configuration parameters: CountComments, ExcludedMethods.
@@ -31,7 +37,7 @@ Metrics/MethodLength:
31
37
  # Offense count: 1
32
38
  # Configuration parameters: CountComments.
33
39
  Metrics/ModuleLength:
34
- Max: 104
40
+ Max: 105
35
41
 
36
42
  # Offense count: 2
37
43
  # Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
@@ -42,16 +48,24 @@ Naming/FileName:
42
48
  - 'spec/mongoid-locker_spec.rb'
43
49
 
44
50
  # Offense count: 1
45
- # Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist, MethodDefinitionMacros.
51
+ # Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros.
46
52
  # NamePrefix: is_, has_, have_
47
- # NamePrefixBlacklist: is_, has_, have_
48
- # NameWhitelist: is_a?
53
+ # ForbiddenPrefixes: is_, has_, have_
54
+ # AllowedMethods: is_a?
49
55
  # MethodDefinitionMacros: define_method, define_singleton_method
50
56
  Naming/PredicateName:
51
57
  Exclude:
52
58
  - 'spec/**/*'
53
59
  - 'lib/mongoid/locker.rb'
54
60
 
61
+ # Offense count: 2
62
+ RSpec/BeforeAfterAll:
63
+ Exclude:
64
+ - 'spec/spec_helper.rb'
65
+ - 'spec/rails_helper.rb'
66
+ - 'spec/support/**/*.rb'
67
+ - 'spec/test_examples_spec.rb'
68
+
55
69
  # Offense count: 12
56
70
  # Configuration parameters: Prefixes.
57
71
  # Prefixes: when, with, without
@@ -61,11 +75,17 @@ RSpec/ContextWording:
61
75
  - 'spec/support/populate_database_shared_context.rb'
62
76
  - 'spec/support/reset_shared_context.rb'
63
77
 
64
- # Offense count: 7
78
+ # Offense count: 1
79
+ RSpec/DescribeClass:
80
+ Exclude:
81
+ - 'spec/test_examples_spec.rb'
82
+
83
+ # Offense count: 8
65
84
  # Configuration parameters: Max.
66
85
  RSpec/ExampleLength:
67
86
  Exclude:
68
87
  - 'spec/support/locker_is_included_shared_examples.rb'
88
+ - 'spec/test_examples_spec.rb'
69
89
 
70
90
  # Offense count: 1
71
91
  # Configuration parameters: CustomTransform, IgnoreMethods.
@@ -73,10 +93,11 @@ RSpec/FilePath:
73
93
  Exclude:
74
94
  - 'spec/mongoid-locker_spec.rb'
75
95
 
76
- # Offense count: 5
96
+ # Offense count: 7
77
97
  RSpec/LeakyConstantDeclaration:
78
98
  Exclude:
79
99
  - 'spec/support/configurations_shared_context.rb'
100
+ - 'spec/test_examples_spec.rb'
80
101
 
81
102
  # Offense count: 12
82
103
  # Configuration parameters: .
@@ -84,11 +105,16 @@ RSpec/LeakyConstantDeclaration:
84
105
  RSpec/MessageSpies:
85
106
  EnforcedStyle: receive
86
107
 
87
- # Offense count: 11
108
+ # Offense count: 10
88
109
  # Configuration parameters: AggregateFailuresByDefault.
89
110
  RSpec/MultipleExpectations:
90
111
  Max: 3
91
112
 
113
+ # Offense count: 1
114
+ RSpec/SubjectStub:
115
+ Exclude:
116
+ - 'spec/support/delegated_methods_shared_examples.rb'
117
+
92
118
  # Offense count: 2
93
119
  Style/Documentation:
94
120
  Exclude:
@@ -105,9 +131,9 @@ Style/NumericPredicate:
105
131
  - 'spec/**/*'
106
132
  - 'lib/mongoid/locker.rb'
107
133
 
108
- # Offense count: 33
134
+ # Offense count: 35
109
135
  # Cop supports --auto-correct.
110
136
  # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
111
137
  # URISchemes: http, https
112
- Metrics/LineLength:
138
+ Layout/LineLength:
113
139
  Max: 250
@@ -10,11 +10,12 @@ script:
10
10
 
11
11
  rvm:
12
12
  - 2.3.8
13
- - 2.4.5
14
- - 2.5.4
15
- - 2.6.2
13
+ - 2.4.7
14
+ - 2.5.7
15
+ - 2.6.6
16
+ - 2.7.1
16
17
  - jruby-9.1.17.0
17
- - jruby-9.2.6.0
18
+ - jruby-9.2.11.1
18
19
 
19
20
  env:
20
21
  - MONGOID_VERSION=5
@@ -23,7 +24,7 @@ env:
23
24
 
24
25
  matrix:
25
26
  include:
26
- - rvm: 2.6.2
27
+ - rvm: 2.6.6
27
28
  env:
28
29
  - MONGOID_VERSION=7
29
30
  - COVERAGE=true
@@ -39,7 +40,12 @@ matrix:
39
40
  ./cc-test-reporter upload-coverage;
40
41
  fi
41
42
  - rvm: ruby-head
43
+ env: MONGOID_VERSION=7
42
44
  - rvm: jruby-head
45
+ env: MONGOID_VERSION=7
46
+ exclude:
47
+ - rvm: 2.7.1
48
+ env: MONGOID_VERSION=5
43
49
  fast_finish: true
44
50
  allow_failures:
45
51
  - rvm: ruby-head
@@ -1,5 +1,12 @@
1
1
  ## Changelog
2
2
 
3
+ ### 2.0.1 (2020-06-17)
4
+
5
+ * [#86](https://github.com/mongoid/mongoid-locker/pull/86): Upgraded to RuboCop 0.81.0 - [@dks17](https://github.com/dks17).
6
+ * [#86](https://github.com/mongoid/mongoid-locker/pull/86): Fixed issue with `ruby` `delegate` method - [@dks17](https://github.com/dks17).
7
+ * [#86](https://github.com/mongoid/mongoid-locker/pull/86): Update Ruby and JRUby versions for Travis config - [@dks17](https://github.com/dks17).
8
+ * [#88](https://github.com/mongoid/mongoid-locker/pull/88): Add RSpec test examples - [@dks17](https://github.com/dks17).
9
+
3
10
  ### 2.0.0 (2019-10-23)
4
11
 
5
12
  * [#79](https://github.com/mongoid/mongoid-locker/pull/79): Update find_and_lock and find_and_unlock methods - [@dks17](https://github.com/dks17).
data/Gemfile CHANGED
@@ -24,8 +24,8 @@ group :development, :test do
24
24
  gem 'pry-byebug', platforms: :mri
25
25
 
26
26
  gem 'mongoid-danger', '~> 0.1.1'
27
- gem 'rspec', '~> 3.8'
28
- gem 'rubocop', '0.75.1'
29
- gem 'rubocop-rspec'
27
+ gem 'rspec', '~> 3.9'
28
+ gem 'rubocop', '0.81.0'
29
+ gem 'rubocop-rspec', '1.38.1'
30
30
  gem 'simplecov', require: false
31
31
  end
data/README.md CHANGED
@@ -12,8 +12,8 @@ Document-level optimistic locking for MongoDB via Mongoid. Mongoid-Locker is an
12
12
  **NOTE:** Please refer to [1-x-stable](https://github.com/mongoid/mongoid-locker/tree/1-x-stable) branch for `1.x.x` documentation. See the [UPGRADING](UPGRADING.md) guide and [CHANGELOG](CHANGELOG.md) for an overview of the changes.
13
13
 
14
14
  [Tested](https://travis-ci.org/mongoid/mongoid-locker) against:
15
- - MRI: `2.3.8`, `2.4.5`, `2.5.4`, `2.6.2`
16
- - JRuby `9.1.17.0`, `9.2.6.0`
15
+ - MRI: `2.3.8`, `2.4.7`, `2.5.7`, `2.6.6`, `2.7.1`
16
+ - JRuby `9.1.17.0`, `9.2.11.1`
17
17
  - Mongoid: `5`, `6`, `7`
18
18
 
19
19
  See [.travis.yml](.travis.yml) for the latest test matrix.
@@ -155,8 +155,11 @@ class User
155
155
  end
156
156
  ```
157
157
 
158
+ ## Testing with RSpec
159
+ Please see examples in [test_examples_spec.rb](spec/test_examples_spec.rb) file.
160
+
158
161
  ## Copyright & License
159
162
 
160
- Copyright (c) 2012-2019 Aidan Feldman & Contributors
163
+ Copyright (c) 2012-2020 Aidan Feldman & Contributors
161
164
 
162
165
  MIT License, see [LICENSE](LICENSE.txt) for more information.
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'forwardable'
3
4
  require 'securerandom'
4
5
 
5
6
  module Mongoid
@@ -103,6 +104,8 @@ module Mongoid
103
104
 
104
105
  # @api private
105
106
  def included(klass)
107
+ klass.extend(Forwardable) unless klass.ancestors.include?(Forwardable)
108
+
106
109
  klass.extend ClassMethods
107
110
  klass.singleton_class.instance_eval { attr_accessor(*MODULE_METHODS) }
108
111
 
@@ -114,7 +117,7 @@ module Mongoid
114
117
  klass.backoff_algorithm = backoff_algorithm
115
118
  klass.locking_name_generator = locking_name_generator
116
119
 
117
- klass.delegate(*MODULE_METHODS, to: :class)
120
+ klass.def_delegators(klass, *MODULE_METHODS)
118
121
  klass.singleton_class.delegate(*(methods(false) - MODULE_METHODS.flat_map { |method| [method, "#{method}=".to_sym] } - %i[included reset! configure]), to: self)
119
122
  end
120
123
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Mongoid
4
4
  module Locker
5
- VERSION = '2.0.0'
5
+ VERSION = '2.0.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-locker
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aidan Feldman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-23 00:00:00.000000000 Z
11
+ date: 2020-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
79
  - !ruby/object:Gem::Version
80
80
  version: '0'
81
81
  requirements: []
82
- rubygems_version: 3.0.3
82
+ rubygems_version: 3.1.3
83
83
  signing_key:
84
84
  specification_version: 4
85
85
  summary: Document-level optimistic locking for MongoDB via Mongoid.