rubocop-rspec_parity 1.3.1 → 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,9 @@
|
|
|
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
|
+
|
|
3
7
|
## [1.3.1] - 2026-02-13
|
|
4
8
|
|
|
5
9
|
Added: `PublicMethodHasSpec` now excludes Ruby hook methods (`self.included`, `self.extended`, `self.inherited`, `self.prepended`) from requiring specs
|
|
@@ -310,10 +310,11 @@ module RuboCop
|
|
|
310
310
|
|
|
311
311
|
def spec_has_examples?(spec_path, class_name)
|
|
312
312
|
spec_content = File.read(spec_path)
|
|
313
|
-
escaped_class_name = Regexp.escape(class_name)
|
|
314
313
|
|
|
315
|
-
# Check that the spec describes the correct class
|
|
316
|
-
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
|
|
317
318
|
|
|
318
319
|
# Check for any it/example/specify blocks
|
|
319
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)
|