lib/rubocop/cop/rspec/message_chain.rb in rubocop-rspec-2.1.0 vs lib/rubocop/cop/rspec/message_chain.rb in rubocop-rspec-2.2.0
- old
+ new
@@ -13,21 +13,15 @@
# thing = Thing.new(baz: 42)
# allow(foo).to receive(:bar).and_return(thing)
#
class MessageChain < Base
MSG = 'Avoid stubbing using `%<method>s`.'
+ RESTRICT_ON_SEND = %i[receive_message_chain stub_chain].freeze
- def_node_matcher :message_chain, <<-PATTERN
- (send _ {:receive_message_chain :stub_chain} ...)
- PATTERN
-
def on_send(node)
- message_chain(node) do
- add_offense(
- node.loc.selector,
- message: format(MSG, method: node.method_name)
- )
- end
+ add_offense(
+ node.loc.selector, message: format(MSG, method: node.method_name)
+ )
end
end
end
end
end