Class: RuboCop::Cop::RSpec::AnyInstance
- Defined in:
- lib/rubocop/cop/rspec/any_instance.rb
Overview
Check that instances are not being stubbed globally.
Prefer instance doubles over stubbing any instance of a class
Constant Summary collapse
- MSG =
'Avoid stubbing using `%<method>s`.'.freeze
Constants inherited from Cop
Cop::DEFAULT_CONFIGURATION, Cop::DEFAULT_PATTERN_RE
Constants included from RSpec::Language
Instance Method Summary collapse
Methods inherited from Cop
Instance Method Details
#on_send(node) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/rubocop/cop/rspec/any_instance.rb', line 30 def on_send(node) disallowed_stub(node) do |method| add_offense( node, location: :expression, message: format(MSG, method: method) ) end end |