Class: RuboCop::Cop::Minitest::TestFileName
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Minitest::TestFileName
- Includes:
- RuboCop::Cop::MinitestExplorationHelpers
- Defined in:
- lib/rubocop/cop/minitest/test_file_name.rb
Overview
Checks if test file names start with ‘test_` or end with `_test.rb`. Files which define classes having names ending with `Test` are checked. Not following this convention may result in tests not being run.
Constant Summary collapse
- MSG =
'Test file path should start with `test_` or end with `_test.rb`.'
Constants included from RuboCop::Cop::MinitestExplorationHelpers
RuboCop::Cop::MinitestExplorationHelpers::ASSERTION_PREFIXES, RuboCop::Cop::MinitestExplorationHelpers::LIFECYCLE_HOOK_METHODS, RuboCop::Cop::MinitestExplorationHelpers::LIFECYCLE_HOOK_METHODS_IN_ORDER
Instance Method Summary collapse
Instance Method Details
#on_new_investigation ⇒ Object
23 24 25 26 27 28 |
# File 'lib/rubocop/cop/minitest/test_file_name.rb', line 23 def on_new_investigation return unless (ast = processed_source.ast) return unless test_file?(ast) add_global_offense(MSG) unless valid_file_name? end |