lib/rubocop/cop/rspec/message_chain.rb in rubocop-rspec-1.8.0 vs lib/rubocop/cop/rspec/message_chain.rb in rubocop-rspec-1.9.0
- old
+ new
@@ -10,21 +10,14 @@
# # better
# thing = Thing.new(baz: 42)
# allow(foo).to receive(bar: thing)
#
class MessageChain < Cop
- include RuboCop::RSpec::SpecOnly
-
MESSAGE = 'Avoid stubbing using `%<method>s`'.freeze
- MESSAGE_CHAIN_METHODS = [
- :receive_message_chain,
- :stub_chain
- ].freeze
-
def on_send(node)
_receiver, method_name, *_args = *node
- return unless MESSAGE_CHAIN_METHODS.include?(method_name)
+ return unless Matchers::MESSAGE_CHAIN.include?(method_name)
add_offense(node, :selector, MESSAGE % { method: method_name })
end
end
end