rubocop-minitest icon indicating copy to clipboard operation
rubocop-minitest copied to clipboard

Code style checking for Minitest files.

Results 17 rubocop-minitest issues
Sort by recently updated
recently updated
newest added

When applying `Minitest/AssertMatch` (or `Minitest/RefuteMatch`)'s auto-fix to the following the working code: ```ruby require "minitest/autorun" class AssertMatchTest < Minitest::Test def test_assert_match_autofix hello = "Hello World!" greeting = %r{Hello} assert hello.match?(%r{World})...

Counting assertions based on a string prefix of "assert_" or "refute_" is replaced by a symbol comparison against the 38 Minitest assertion methods.

`AssertMatch` & `RefuteMatch` enforce ```diff -assert matcher.match?(object) +assert_match(matcher, object) ``` and ```diff -refute matcher.match?(object) +refute_match(matcher, object) ``` respectively, which use `=~` under the hood. This makes the cops highly susceptible...

All methods which start with "assert_" or "refute_" are currently assumed to be (and counted as) Minitest assertions. E.g. With `Minitest/MultipleAssertions` Max of 1 the following registers an offense. ```ruby...

## 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](https://github.com/rubocop/rubocop-minitest/blob/4d08365be08d06b02bb2c11415a4e8060331a0bb/lib/rubocop/cop/mixin/minitest_exploration_helpers.rb#L29)....

## Bug Description The rules `Minitest/Assert*` has some conflicts with [Rails/RefuteMethods](https://github.com/rubocop/rubocop-rails/blob/master/lib/rubocop/cop/rails/refute_methods.rb). It has default policy to convert `refute_*` statements to `assert_not_*` which causes `Minitest/Assert*` to be ignored. Example: ``` ruby...

Thought: should `Minitest/AssertIncludes`, `Minitest/RefuteIncludes` also detect common aliases of `include?`? Maybe via an option? ```ruby # bad assert hash.include?(:foo) # currently supported ✔️ assert hash.key?(:foo) assert hash.has_key?(:foo) assert hash.member?(:foo) #...