Skip to content
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

Add new Minitest/AssertWithExpectedArgument cop #120

Merged
merged 1 commit into from
Mar 20, 2021

Commits on Mar 20, 2021

  1. [Fix rubocop#117] Add new Minitest/AssertWithExpectedArgument cop

    It is a common mistake to use `assert` instead of `assert_equal`. This
    is dangerous because minitest will treat the second argument to `assert`
    as the `msg` parameter and, as long as the first argument is truthy, the
    test will always pass. This false negative gives the user a sense of
    security even though they're not actually testing what they think they
    are.
    
    This commit introduces a new cop which will register a violation if
    `assert` is called with two arguments and the second argument isn't a
    `String`. If the second argument *is* a `String`, then the user is
    likely using `assert` as intended. If it's not, most of the time it
    means a mistake has been made.
    cstyles committed Mar 20, 2021
    Configuration menu
    Copy the full SHA
    2dea4e6 View commit details
    Browse the repository at this point in the history