Class: RuboCop::Cop::Minitest::GlobalExpectations
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Minitest::GlobalExpectations
- Extended by:
- AutoCorrector
- Includes:
- ConfigurableEnforcedStyle
- Defined in:
- lib/rubocop/cop/minitest/global_expectations.rb
Overview
Checks for deprecated global expectations and autocorrects them to use expect format.
Constant Summary collapse
- MSG =
'Use `%<preferred>s` instead.'- VALUE_MATCHERS =
MinitestExplorationHelpers::VALUE_MATCHERS
- BLOCK_MATCHERS =
MinitestExplorationHelpers::BLOCK_MATCHERS
- RESTRICT_ON_SEND =
MinitestExplorationHelpers::MATCHER_METHODS
- DSL_METHODS =
There are aliases for the
_method -expectandvalue %i[_ expect value].freeze
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
98 99 100 101 102 103 104 105 106 |
# File 'lib/rubocop/cop/minitest/global_expectations.rb', line 98 def on_send(node) receiver = node.receiver return unless receiver method = block_receiver?(receiver) || value_receiver?(receiver) return if method == preferred_method || (method && style == :any) register_offense(node, method) end |