lib/rubocop/cop/rspec/empty_example_group.rb in rubocop-rspec-2.18.1 vs lib/rubocop/cop/rspec/empty_example_group.rb in rubocop-rspec-2.19.0
- old
+ new
@@ -51,11 +51,11 @@
# end
#
# @param node [RuboCop::AST::Node]
# @yield [RuboCop::AST::Node] example group body
def_node_matcher :example_group_body, <<~PATTERN
- (block #{send_pattern('#ExampleGroups.all')} args $_)
+ (block (send #rspec? #ExampleGroups.all ...) args $_)
PATTERN
# @!method example_or_group_or_include?(node)
# Match examples, example groups and includes
#
@@ -70,14 +70,14 @@
#
# @param node [RuboCop::AST::Node]
# @return [Array<RuboCop::AST::Node>] matching nodes
def_node_matcher :example_or_group_or_include?, <<~PATTERN
{
- #{block_pattern(
- '{#Examples.all #ExampleGroups.all #Includes.all}'
- )}
- #{send_pattern('{#Examples.all #Includes.all}')}
+ (block
+ (send #rspec? {#Examples.all #ExampleGroups.all #Includes.all} ...)
+ ...)
+ (send nil? {#Examples.all #Includes.all} ...)
}
PATTERN
# @!method examples_inside_block?(node)
# Match examples defined inside a block which is not a hook
@@ -93,11 +93,11 @@
# end
#
# @param node [RuboCop::AST::Node]
# @return [Array<RuboCop::AST::Node>] matching nodes
def_node_matcher :examples_inside_block?, <<~PATTERN
- (block !#{send_pattern('#Hooks.all')} _ #examples?)
+ (block !(send nil? #Hooks.all ...) _ #examples?)
PATTERN
# @!method examples_directly_or_in_block?(node)
# Match examples or examples inside blocks
#
@@ -172,10 +172,10 @@
condition_node.branches.any? { |branch| examples?(branch) }
end
def removed_range(node)
range_by_whole_lines(
- node.location.expression,
+ node.source_range,
include_final_newline: true
)
end
end
end