Class: RuboCop::Cop::Minitest::NoTestCases

Inherits:
Base
  • Object
show all
Includes:
RuboCop::Cop::MinitestExplorationHelpers
Defined in:
lib/rubocop/cop/minitest/no_test_cases.rb

Overview

Checks if test class contains any test cases.

Examples:

# bad
class FooTest < Minitest::Test
  def do_something
  end
end

# good
class FooTest < Minitest::Test
  def test_something
    assert true
  end
end

Constant Summary collapse

MSG =
'Test class should have test cases.'

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_class(node) ⇒ Object



27
28
29
30
31
# File 'lib/rubocop/cop/minitest/no_test_cases.rb', line 27

def on_class(node)
  return unless test_class?(node)

  add_offense(node) if test_cases(node).empty?
end