-
-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New cop: Minitest/TestFileName
#213
Comments
Can you point out bad and good cases with code? |
Bad # Defined in test/something.rb file
class SomethingTest < Minitest::Test
def test_foo
# ...
end
end Good # Defined in test/something_test.rb file
class SomethingTest < Minitest::Test
def test_foo
# ...
end
end |
I guess this cop will be very similar to RSpec/FilePath. |
Yes. Rspec's cop enforces that the file is named as a tested class also (besides the suffix). In minitest, sometimes in a single test file there are multiple test classes (a |
I added a guideline relating to this to the styleguide a while ago: https://github.com/rubocop/minitest-style-guide#file-naming And I just opened this PR: |
(Brief reply as I'm on mobile). The naming convention could be configurable, to avoid the risk of the file name not matching an expected pattern, e.g. *_test |
This cop should check if we have a test class inside the file without the
_test
suffix.In this case, this file will be just ignored when running all the tests and go unnoticed.
The text was updated successfully, but these errors were encountered: