lib/rubocop/rspec/example_group.rb in rubocop-rspec-1.25.1 vs lib/rubocop/rspec/example_group.rb in rubocop-rspec-1.26.0
- old
+ new
@@ -12,18 +12,16 @@
#
def_node_matcher :scope_change?, (
ExampleGroups::ALL + SharedGroups::ALL + Includes::ALL
).block_pattern
- # @!method hook(node)
+ # @!method hook?(node)
#
# Detect if node is `before`, `after`, `around`
- def_node_matcher :hook, <<-PATTERN
- (block {$(send nil? #{Hooks::ALL.node_pattern_union} ...)} ...)
- PATTERN
+ def_node_matcher :hook?, Hooks::ALL.block_pattern
- def_node_matcher :subject, Subject::ALL.block_pattern
+ def_node_matcher :subject?, Subject::ALL.block_pattern
def subjects
subjects_in_scope(node)
end
@@ -44,11 +42,11 @@
end
def find_subjects(node)
return [] if scope_change?(node)
- if subject(node)
+ if subject?(node)
[node]
else
subjects_in_scope(node)
end
end
@@ -60,10 +58,10 @@
end
def find_hooks(node)
return [] if scope_change?(node) || example?(node)
- if hook(node)
+ if hook?(node)
[node]
else
hooks_in_scope(node)
end
end