lib/rubocop/cop/rspec/unspecified_exception.rb in rubocop-rspec-1.32.0 vs lib/rubocop/cop/rspec/unspecified_exception.rb in rubocop-rspec-1.33.0

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + module RuboCop module Cop module RSpec # Checks for a specified error in checking raised errors. # @@ -27,13 +29,13 @@ # raise StandardError.new('error') # }.to raise_error(/err/) # # expect { do_something }.not_to raise_error class UnspecifiedException < Cop - MSG = 'Specify the exception being captured'.freeze + MSG = 'Specify the exception being captured' - def_node_matcher :empty_raise_error_or_exception, <<-PATTERN.freeze + def_node_matcher :empty_raise_error_or_exception, <<-PATTERN (send (block (send nil? :expect) ...) :to (send nil? {:raise_error :raise_exception}) @@ -52,10 +54,10 @@ def empty_exception_matcher?(node) empty_raise_error_or_exception(node) && !block_with_args?(node.parent) end def block_with_args?(node) - return unless node && node.block_type? + return unless node&.block_type? node.arguments? end end end