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: 59550603208cc66c70a19abf793efa8e7270cdeec36763f0741dfce34ee8c9aa
4
- data.tar.gz: '0358d0407ba0ecc1efd22ae857ab0dd48ceef4fc2f918830765c24d6f571bff8'
3
+ metadata.gz: fe061c7b11557dedba1714eeb2df39a1030bf990a509501dda39781277557aca
4
+ data.tar.gz: aff7a164338bc4f5b23a9aacf1a3b04c91e040f18bccd7cbdbdc0e931b6bb8b5
5
5
  SHA512:
6
- metadata.gz: c90624cc159b7a13961a0e875c8eef655c2d285a3fb84c717e83c926541bba27123e93fee4a4ea59de57ae5f3cc1775e4adf80546de66a4b3b8df9e59912a0f8
7
- data.tar.gz: 27b7536b495f064e1d06cb8c2c0c733b4099699907755b14f64cd8c0d0ecdfa23677dcf5899dd6a9b3c30cc92add8780da091d585a6fe9e0d1f8ef10a75de1ce
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 spec_content.match?(/(?:RSpec\.)?describe\s+#{escaped_class_name}(?:\s|,|do)/)
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
- # Match RSpec.describe ClassName or describe ClassName
73
- spec_content.match?(/(?:RSpec\.)?describe\s+#{Regexp.escape(class_name)}(?:\s|,|do)/)
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)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module RSpecParity
5
- VERSION = "1.3.1"
5
+ VERSION = "1.3.2"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-rspec_parity
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Povilas Jurcys