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 =
i[ must_be_empty must_equal must_be_close_to must_be_within_delta must_be_within_epsilon must_include must_be_instance_of must_be_kind_of must_match must_be_nil must_be must_respond_to must_be_same_as path_must_exist path_wont_exist wont_be_empty wont_equal wont_be_close_to wont_be_within_delta wont_be_within_epsilon wont_include wont_be_instance_of wont_be_kind_of wont_match wont_be_nil wont_be wont_respond_to wont_be_same_as ].freeze
- BLOCK_MATCHERS =
i[ must_output must_pattern_match must_raise must_be_silent must_throw wont_pattern_match ].freeze
- RESTRICT_ON_SEND =
VALUE_MATCHERS + BLOCK_MATCHERS
- DSL_METHODS =
There are aliases for the ‘_` method - `expect` and `value`
i[_ expect value].freeze
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
108 109 110 111 112 113 114 115 116 |
# File 'lib/rubocop/cop/minitest/global_expectations.rb', line 108 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 |