rubocop-rspec_parity 1.3.0 → 1.3.2
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fe061c7b11557dedba1714eeb2df39a1030bf990a509501dda39781277557aca
|
|
4
|
+
data.tar.gz: aff7a164338bc4f5b23a9aacf1a3b04c91e040f18bccd7cbdbdc0e931b6bb8b5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b1989fb64fc261fb90ce9a3f0a8493715cf7f36015679424dd1a5e746f8cb47682901222c8f1ca078ccc310441a03b8c7671b77e331ae659933d863cfab55449
|
|
7
|
+
data.tar.gz: 8e173ee1fd7e2aa65e29efe31ed30d5c05fac453579d79bcf3e53c8a7ad9617de435be3cd7b86ae4d5e3cc46815c913bffa939ac36ff3321944b5d2796443267
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [1.3.2] - 2026-02-20
|
|
4
|
+
|
|
5
|
+
Fixed: `PublicMethodHasSpec` now recognizes specs that use module wrapping (e.g., `module Foo; RSpec.describe Bar`) instead of fully qualified class names
|
|
6
|
+
|
|
7
|
+
## [1.3.1] - 2026-02-13
|
|
8
|
+
|
|
9
|
+
Added: `PublicMethodHasSpec` now excludes Ruby hook methods (`self.included`, `self.extended`, `self.inherited`, `self.prepended`) from requiring specs
|
|
10
|
+
|
|
3
11
|
## [1.3.0] - 2026-02-13
|
|
4
12
|
|
|
5
13
|
Added: `IgnoreMemoization` now skips all `||=` patterns including local variables and hash keys, not just instance variables
|
|
@@ -20,6 +20,7 @@ module RuboCop
|
|
|
20
20
|
|
|
21
21
|
COVERED_DIRECTORIES = %w[models controllers services jobs mailers helpers].freeze
|
|
22
22
|
EXCLUDED_METHODS = %w[initialize].freeze
|
|
23
|
+
EXCLUDED_HOOK_METHODS = %w[included extended inherited prepended].freeze
|
|
23
24
|
EXCLUDED_PATTERNS = [/^before_/, /^after_/, /^around_/, /^validate_/, /^autosave_/].freeze
|
|
24
25
|
VISIBILITY_METHODS = { private: :private, protected: :protected, public: :public }.freeze
|
|
25
26
|
|
|
@@ -37,6 +38,7 @@ module RuboCop
|
|
|
37
38
|
|
|
38
39
|
def on_defs(node)
|
|
39
40
|
return unless checkable_method?(node) && public_class_method?(node)
|
|
41
|
+
return if EXCLUDED_HOOK_METHODS.include?(node.method_name.to_s)
|
|
40
42
|
|
|
41
43
|
check_method_has_spec(node, instance_method: false)
|
|
42
44
|
end
|
|
@@ -308,10 +310,11 @@ module RuboCop
|
|
|
308
310
|
|
|
309
311
|
def spec_has_examples?(spec_path, class_name)
|
|
310
312
|
spec_content = File.read(spec_path)
|
|
311
|
-
escaped_class_name = Regexp.escape(class_name)
|
|
312
313
|
|
|
313
|
-
# Check that the spec describes the correct class
|
|
314
|
-
return false unless
|
|
314
|
+
# Check that the spec describes the correct class (supports module-wrapped specs)
|
|
315
|
+
return false unless class_name_variants(class_name).any? do |name|
|
|
316
|
+
spec_content.match?(/(?:RSpec\.)?describe\s+#{Regexp.escape(name)}(?:\s|,|do)/)
|
|
317
|
+
end
|
|
315
318
|
|
|
316
319
|
# Check for any it/example/specify blocks
|
|
317
320
|
spec_content.match?(/^\s*(?:it|example|specify)\s+/)
|
|
@@ -69,8 +69,16 @@ module RuboCop
|
|
|
69
69
|
|
|
70
70
|
def spec_describes_class?(spec_path, class_name)
|
|
71
71
|
spec_content = File.read(spec_path)
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
class_name_variants(class_name).any? do |name|
|
|
73
|
+
spec_content.match?(/(?:RSpec\.)?describe\s+#{Regexp.escape(name)}(?:\s|,|do)/)
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def class_name_variants(class_name)
|
|
78
|
+
parts = class_name.split("::")
|
|
79
|
+
return [class_name] if parts.size <= 1
|
|
80
|
+
|
|
81
|
+
[class_name, parts.last]
|
|
74
82
|
end
|
|
75
83
|
|
|
76
84
|
def describe_aliases_for(describe_key)
|