We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a869f46 commit 5e2630dCopy full SHA for 5e2630d
lib/rubocop/cop/rspec/named_subject.rb
@@ -45,7 +45,7 @@ class NamedSubject < Base
45
MSG = 'Name your test subject if you need '\
46
'to reference it explicitly.'
47
48
- def_node_matcher :rspec_block?, <<-PATTERN
+ def_node_matcher :example_or_hook_block?, <<-PATTERN
49
{
50
#{Examples::ALL.block_pattern}
51
#{RuboCop::RSpec::Language.block_pattern('#rspec_hooks')}
@@ -59,7 +59,9 @@ class NamedSubject < Base
59
def_node_search :subject_usage, '$(send nil? :subject)'
60
61
def on_block(node)
62
- return if !rspec_block?(node) || ignored_shared_example?(node)
+ if !example_or_hook_block?(node) || ignored_shared_example?(node)
63
+ return
64
+ end
65
66
subject_usage(node) do |subject_node|
67
add_offense(subject_node.loc.selector)
0 commit comments