Sha256: ace5be1726994ea72228d3400f792dc64e07e3899b47eff1ab945dc243069639
Contents?: true
Size: 692 Bytes
Versions: 3
Compression:
Stored size: 692 Bytes
Contents
module RuboCop module Cop module RSpec # Check that chains of messages are not being stubbed. # # @example # # bad # allow(foo).to receive_message_chain(:bar, :baz).and_return(42) # # # better # thing = Thing.new(baz: 42) # allow(foo).to receive(bar: thing) # class MessageChain < Cop MESSAGE = 'Avoid stubbing using `%<method>s`'.freeze def on_send(node) _receiver, method_name, *_args = *node return unless Matchers::MESSAGE_CHAIN.include?(method_name) add_offense(node, :selector, format(MESSAGE, method: method_name)) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rubocop-rspec-1.12.0 | lib/rubocop/cop/rspec/message_chain.rb |
rubocop-rspec-1.11.0 | lib/rubocop/cop/rspec/message_chain.rb |
rubocop-rspec-1.10.0 | lib/rubocop/cop/rspec/message_chain.rb |