rubocop-rspec_parity 1.3.3 → 1.3.4

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: 22422977377471478233dd86ea759dde042e3a099577c0a77b611667f792cbf5
4
- data.tar.gz: 1082c7d45b3c9da60de09f7a7db0567f63353e623af74f9d26e304a94464d5bf
3
+ metadata.gz: b634068a8fe93d9576c210988a5ebab48f22f25058cf7c50e21710de1b7fb775
4
+ data.tar.gz: 9ac6bd2fc8503e43013e25e03413cb32dd8eb3d6ee44480f1a243f41e006781f
5
5
  SHA512:
6
- metadata.gz: 5396c1d32d186548dd9b58910da704e271c76d818613cfe8b1776394f1c07fc097b8d0b4a5e06e8531b3899733f449ae4c7dd7ca5d2243991c3953a885f00dbe
7
- data.tar.gz: d0f02db94469e02b4e79dff03b7ae1f9a7555501604f2ecd4f1dd5266844cb94c248815884ea8e053fb75024c045dbed7f4a5cd73574bc957db36b8a32e62c96
6
+ metadata.gz: ab0f3101fd7603ec83438f91772b6991446c9fbb2102cc32ebb948a02df1cfe8a6217e71b2629ba695135b717322d9ba6bd686bfe1a9f58fbe292ea1b70357ba
7
+ data.tar.gz: d30491decd3a61710bf1c873bbd268aad7d5a40e6d209b46676bf469871c54087e13a6111a47ad83437d5becb6416e5075cec6ca6a0e00a7b7657c873bb44ce2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.3.4] - 2026-02-23
4
+
5
+ Added: `PublicMethodHasSpec` now treats methods inside `class_methods do` blocks (ActiveSupport::Concern) as class methods, expecting `.method_name` in specs
6
+
3
7
  ## [1.3.3] - 2026-02-20
4
8
 
5
9
  Fixed: `PublicMethodHasSpec` offense message now shows correct method prefix (`#` for instance methods, `.` for class methods) and includes configured `DescribeAliases` in the expected describes
@@ -34,7 +34,7 @@ module RuboCop
34
34
  return unless checkable_method?(node) && public_method?(node)
35
35
  return if inside_inner_class?(node)
36
36
 
37
- check_method_has_spec(node, instance_method: !inside_eigenclass?(node))
37
+ check_method_has_spec(node, instance_method: !inside_eigenclass?(node) && !inside_class_methods_block?(node))
38
38
  end
39
39
 
40
40
  def on_defs(node)
@@ -77,6 +77,12 @@ module RuboCop
77
77
  node.each_ancestor.any? { |a| a.sclass_type? && a.children.first&.self_type? }
78
78
  end
79
79
 
80
+ def inside_class_methods_block?(node)
81
+ node.each_ancestor(:block).any? do |block_node|
82
+ block_node.send_node.method_name == :class_methods
83
+ end
84
+ end
85
+
80
86
  def inside_inner_class?(node)
81
87
  enclosing = find_class_or_module(node)
82
88
  return false unless enclosing
@@ -127,7 +133,13 @@ module RuboCop
127
133
  end
128
134
 
129
135
  def find_enclosing_scope(node)
130
- node.each_ancestor.find { |n| n.class_type? || n.module_type? || n.sclass_type? }
136
+ node.each_ancestor.find do |n|
137
+ n.class_type? || n.module_type? || n.sclass_type? || class_methods_block?(n)
138
+ end
139
+ end
140
+
141
+ def class_methods_block?(node)
142
+ node.block_type? && node.send_node.method_name == :class_methods
131
143
  end
132
144
 
133
145
  def find_class_or_module(node)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module RSpecParity
5
- VERSION = "1.3.3"
5
+ VERSION = "1.3.4"
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.3
4
+ version: 1.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Povilas Jurcys