Class: RuboCop::Cop::RSpec::MessageChain
- Inherits:
-
Cop
- Object
- WorkaroundCop
- Cop
- RuboCop::Cop::RSpec::MessageChain
show all
- Defined in:
- lib/rubocop/cop/rspec/message_chain.rb
Overview
Check that chains of messages are not being stubbed.
Constant Summary
collapse
- MSG =
'Avoid stubbing using `%<method>s`.'.freeze
Constants inherited
from Cop
Cop::DEFAULT_CONFIGURATION
RSpec::Language::ALL
Instance Method Summary
collapse
Methods inherited from Cop
inherited, #relevant_file?
Instance Method Details
#message(node) ⇒ Object
23
24
25
|
# File 'lib/rubocop/cop/rspec/message_chain.rb', line 23
def message(node)
format(MSG, method: node.method_name)
end
|
#on_send(node) ⇒ Object
19
20
21
|
# File 'lib/rubocop/cop/rspec/message_chain.rb', line 19
def on_send(node)
message_chain(node) { add_offense(node, :selector) }
end
|