lib/rubocop/cop/rspec/shared_examples.rb in rubocop-rspec-2.26.0 vs lib/rubocop/cop/rspec/shared_examples.rb in rubocop-rspec-2.26.1
- old
+ new
@@ -44,17 +44,16 @@
include ConfigurableEnforcedStyle
# @!method shared_examples(node)
def_node_matcher :shared_examples, <<~PATTERN
{
- (send #rspec? #SharedGroups.all ...)
- (send nil? #Includes.all ...)
+ (send #rspec? #SharedGroups.all $_ ...)
+ (send nil? #Includes.all $_ ...)
}
PATTERN
def on_send(node)
- shared_examples(node) do
- ast_node = node.first_argument
+ shared_examples(node) do |ast_node|
next unless offense?(ast_node)
checker = new_checker(ast_node)
add_offense(ast_node, message: checker.message) do |corrector|
corrector.replace(ast_node, checker.preferred_style)