lib/rubocop/cop/rspec/hooks_before_examples.rb in rubocop-rspec-2.18.1 vs lib/rubocop/cop/rspec/hooks_before_examples.rb in rubocop-rspec-2.19.0
- old
+ new
@@ -28,12 +28,14 @@
MSG = 'Move `%<hook>s` above the examples in the group.'
# @!method example_or_group?(node)
def_node_matcher :example_or_group?, <<-PATTERN
{
- #{block_pattern('{#ExampleGroups.all #Examples.all}')}
- #{numblock_pattern('{#ExampleGroups.all #Examples.all}')}
- #{send_pattern('#Includes.examples')}
+ ({block numblock} {
+ (send #rspec? #ExampleGroups.all ...)
+ (send nil? #Examples.all ...)
+ } ...)
+ (send nil? #Includes.examples ...)
}
PATTERN
def on_block(node)
return unless example_group_with_body?(node)