lib/rubocop/cop/rspec/receive_counts.rb in rubocop-rspec-2.2.0 vs lib/rubocop/cop/rspec/receive_counts.rb in rubocop-rspec-2.3.0
- old
+ new
@@ -28,13 +28,15 @@
MSG = 'Use `%<alternative>s` instead of `%<original>s`.'
RESTRICT_ON_SEND = %i[times].freeze
+ # @!method receive_counts(node)
def_node_matcher :receive_counts, <<-PATTERN
(send $(send _ {:exactly :at_least :at_most} (int {1 2})) :times)
PATTERN
+ # @!method stub?(node)
def_node_search :stub?, '(send nil? :receive ...)'
def on_send(node)
receive_counts(node) do |offending_node|
return unless stub?(offending_node.receiver)