lib/rubocop/cop/rspec/pending_without_reason.rb in rubocop-rspec-2.19.0 vs lib/rubocop/cop/rspec/pending_without_reason.rb in rubocop-rspec-2.20.0

- old
+ new

@@ -68,13 +68,18 @@ } PATTERN # @!method skipped_by_example_method?(node) def_node_matcher :skipped_by_example_method?, <<~PATTERN - (send nil? ${#Examples.skipped #Examples.pending} ...) + (send nil? ${#Examples.skipped #Examples.pending}) PATTERN + # @!method skipped_by_example_method_with_block?(node) + def_node_matcher :skipped_by_example_method_with_block?, <<~PATTERN + ({block numblock} (send nil? ${#Examples.skipped #Examples.pending} ...) ...) + PATTERN + # @!method metadata_without_reason?(node) def_node_matcher :metadata_without_reason?, <<~PATTERN (send #rspec? {#ExampleGroups.all #Examples.all} ... { @@ -100,11 +105,11 @@ if example_group?(parent) || block_node_example_group?(node) on_skipped_by_example_method(node) on_skipped_by_example_group_method(node) elsif example?(parent) - on_skipped_by_in_example_method(node, parent) + on_skipped_by_in_example_method(node) end end private @@ -119,11 +124,11 @@ node.block_node && example_group?(node.block_node) && explicit_rspec?(node.receiver) end - def on_skipped_by_in_example_method(node, _direct_parent) + def on_skipped_by_in_example_method(node) skipped_in_example?(node) do |pending| add_offense(node, message: "Give the reason for #{pending}.") end end @@ -133,9 +138,13 @@ end end def on_skipped_by_example_method(node) skipped_by_example_method?(node) do |pending| + add_offense(node, message: "Give the reason for #{pending}.") + end + + skipped_by_example_method_with_block?(node.parent) do |pending| add_offense(node, message: "Give the reason for #{pending}.") end end def on_skipped_by_example_group_method(node)