Class: RuboCop::Cop::Minitest::Focus
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Minitest::Focus
- Extended by:
- AutoCorrector
- Includes:
- RangeHelp
- Defined in:
- lib/rubocop/cop/minitest/focus.rb
Overview
Enforces tests are not focused.
Constant Summary collapse
- MSG =
'Remove `focus` from tests.'
- RESTRICT_ON_SEND =
[:focus].freeze
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/rubocop/cop/minitest/focus.rb', line 33 def on_send(node) return if node.receiver add_offense(node.loc.selector) do |corrector| range = if node.arguments.none? range_by_whole_lines(node.source_range, include_final_newline: true) else node.loc.selector.join(node.first_argument.source_range.begin) end corrector.remove(range) end end |