Skip to content

Commit

Permalink
Rename 'rspec_block?' -> 'example_or_hook_block?' in NamedSubject
Browse files Browse the repository at this point in the history
  • Loading branch information
sl4vr committed Aug 5, 2020
1 parent 46f0a05 commit 64ed0b4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/rubocop/cop/rspec/named_subject.rb
Expand Up @@ -45,7 +45,7 @@ class NamedSubject < Base
MSG = 'Name your test subject if you need '\
'to reference it explicitly.'

def_node_matcher :rspec_block?, <<-PATTERN
def_node_matcher :example_or_hook_block?, <<-PATTERN
{
#{Examples::ALL.block_pattern}
#{RuboCop::RSpec::Language.block_pattern('#rspec_hooks')}
Expand All @@ -59,7 +59,9 @@ class NamedSubject < Base
def_node_search :subject_usage, '$(send nil? :subject)'

def on_block(node)
return if !rspec_block?(node) || ignored_shared_example?(node)
if !example_or_hook_block?(node) || ignored_shared_example?(node)
return
end

subject_usage(node) do |subject_node|
add_offense(subject_node.loc.selector)
Expand Down

0 comments on commit 64ed0b4

Please sign in to comment.