lib/rubocop/cop/rspec/predicate_matcher.rb in rubocop-rspec-1.24.0 vs lib/rubocop/cop/rspec/predicate_matcher.rb in rubocop-rspec-1.25.0

- old
+ new

@@ -48,14 +48,13 @@ def predicate?(sym) sym.to_s.end_with?('?') end def message_inflected(predicate) - _recv, predicate_name, = *predicate format(MSG_INFLECTED, - predicate_name: predicate_name, - matcher_name: to_predicate_matcher(predicate_name)) + predicate_name: predicate.method_name, + matcher_name: to_predicate_matcher(predicate.method_name)) end # rubocop:disable Metrics/MethodLength def to_predicate_matcher(name) case name = name.to_s @@ -97,21 +96,21 @@ def rewrite_matcher(corrector, predicate, matcher) args = args_loc(predicate).source block_loc = block_loc(predicate) block = block_loc ? block_loc.source : '' - _recv, name, = *predicate - corrector.replace(matcher.loc.expression, - to_predicate_matcher(name) + args + block) + corrector.replace( + matcher.loc.expression, + to_predicate_matcher(predicate.method_name) + args + block + ) end def true?(to_symbol, matcher) - _recv, name, arg = *matcher - result = case name + result = case matcher.method_name when :be, :eq - arg.true_type? + matcher.first_argument.true_type? when :be_truthy, :a_truthy_value true when :be_falsey, :be_falsy, :a_falsey_value, :a_falsy_value false end @@ -178,14 +177,13 @@ !BUILT_IN_MATCHERS.include?(name) && !name.end_with?('?') end def message_explicit(matcher) - _recv, name, = *matcher format(MSG_EXPLICIT, - predicate_name: to_predicate_method(name), - matcher_name: name) + predicate_name: to_predicate_method(matcher.method_name), + matcher_name: matcher.method_name) end def autocorrect_explicit(node) autocorrect_explicit_send(node) || autocorrect_explicit_block(node) @@ -197,10 +195,10 @@ end end def autocorrect_explicit_block(node) predicate_matcher_block?(node) do |actual, matcher| - to_node, = *node + to_node = node.send_node corrector_explicit(to_node, actual, matcher, to_node) end end def corrector_explicit(to_node, actual, matcher, block_child)