From fe40b8a606f4bee5853396978a46c64703192298 Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Fri, 10 Apr 2020 21:08:47 +0900 Subject: [PATCH] [Fix #73] The Minitest department works on `_test.rb` by default Fixes #73. This PR changes the Minitest department works on file names end with `_test.rb` by default. RuboCop Minitest only targets files in `test` directory by default until v0.8.1. ```yaml Minitest: Enabled: true Include: - '**/test/**/*' ``` https://github.com/rubocop-hq/rubocop-minitest/blob/v0.8.1/config/default.yml But test files may be located in a directory other than `test` directory. This PR adds files that end of filename is `_test.rb` to be considered test files. This behavior is similar to how RuboCop RSpec works on `_spec.rb`. https://github.com/rubocop-hq/rubocop-rspec/blob/v1.38.1/config/default.yml#L5 --- CHANGELOG.md | 4 ++++ config/default.yml | 1 + 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2dff5a24..fec99376 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## master (unreleased) +### Changes + +* [#73](https://github.com/rubocop-hq/rubocop-minitest/issues/73): The Minitest department works on file names end with `_test.rb` by default. ([@koic][]) + ## 0.8.1 (2020-04-06) ### Bug fixes diff --git a/config/default.yml b/config/default.yml index ff2de422..2802ef82 100644 --- a/config/default.yml +++ b/config/default.yml @@ -2,6 +2,7 @@ Minitest: Enabled: true Include: - '**/test/**/*' + - '**/*_test.rb' Minitest/AssertEmpty: Description: 'This cop enforces the test to use `assert_empty` instead of using `assert(object.empty?)`.'