rubocop / rubocop-minitest

Code style checking for Minitest files.
https://docs.rubocop.org/rubocop-minitest
MIT License
144 stars 44 forks source link

MultipleAssertions false positive with 'look-alike' assertion methods #321

Open MatzFan opened 2 months ago

MatzFan commented 2 months ago

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.

def test_asserts_once
  assert_equal(:assert_equal, Bar.assert_but_not_a_minitest_assertion)
end

Expected behavior

No offense should be registered, as only one Minitest assertion is called in the test.

Actual behavior

Offense is registered.

Steps to reproduce the problem

See above code sample

RuboCop version

$ [bundle exec] rubocop -V
1.66.1 (using Parser 3.3.5.0, rubocop-ast 1.32.3, running on ruby 3.3.5) [x86_64-linux]
  - rubocop-minitest 0.36.0
  - rubocop-performance 1.21.1