Aller au contenu

Test method naming (ARCH6008)

Ce contenu n’est pas encore disponible dans votre langue.

Key ruby.naming.test-name-convention · Severity info · Category naming

Test methods must follow the framework’s discovery convention or the runner will not execute them. In Minitest, test methods must begin with test_. Non-conforming names lead to silently skipped tests.

class CartTest < Minitest::Test
def checks_total
assert_equal 30, Cart.new([10, 20]).total
end
end
class CartTest < Minitest::Test
def test_total
assert_equal 30, Cart.new([10, 20]).total
end
end

Name test methods per the framework’s discovery convention (a test_ prefix in Minitest).