You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Presently, Rubocop expects a test class name to end with "Test" and this is hard coded at this line. As per this comment using test class names like TestFoo (which happens to be the convention used by Minitest itself) results in Rubocop ignoring the methods in that test class entirely.
Describe the solution you'd like
I'd like to see:
A new cop to detect where a test file includes a class which includes test methods but is not named according to the expected convention (i.e. class names not ending with "Test"). Note it would be important to ignore classes in test files with no test methods, so as to avoid false positives. It is easy (I've done it myself) to name a test class Foo (i.e. mistakenly omit the "Test" suffix) or to incorrectly name a test class with a typo - e.g. FooTst. In such cases all test methods included in the class are skipped by Rubocop, though the code will still run.
Perhaps also the ability to configure the convention hard coded above such that a project could use the "TestFoo" convention instead. I'm not a Rails dev and was not aware of the Rails convention and I guess the demand for anything other than the "FooTest" convention may be vanishingly small, so this requirement may be unnecessary.
Describe alternatives you've considered
Leave as is and expect users to correctly name their test classes!
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Presently, Rubocop expects a test class name to end with "Test" and this is hard coded at this line. As per this comment using test class names like
TestFoo
(which happens to be the convention used by Minitest itself) results in Rubocop ignoring the methods in that test class entirely.Describe the solution you'd like
I'd like to see:
Foo
(i.e. mistakenly omit the "Test" suffix) or to incorrectly name a test class with a typo - e.g.FooTst
. In such cases all test methods included in the class are skipped by Rubocop, though the code will still run.Describe alternatives you've considered
Leave as is and expect users to correctly name their test classes!
The text was updated successfully, but these errors were encountered: